20 Loop Time Complexity Questions with Many Variations | Nested loops | Sachin Mittal sir

  Рет қаралды 15,833

GO Classes for GATE CS

GO Classes for GATE CS

Күн бұрын

Пікірлер: 53
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Session Annotated Notes- shorturl.at/cAEIQ
@nareshk2606
@nareshk2606 9 ай бұрын
for(int j=2;j
@bhargavv_14
@bhargavv_14 Жыл бұрын
Please upload this kind of videos more of every topic. This are very helpful to us ❤
@shaad_iqbal
@shaad_iqbal Жыл бұрын
Great explanation of the last question (Q.18). 🔥🔥
@syedqasim936
@syedqasim936 Жыл бұрын
QUESTION # 17 The time complexity for these loops is O(n log n). This is because the outer loop runs log n times, since the variable i is doubled in each iteration. The inner loop runs i times, which is proportional to n in the worst case. Therefore, the total number of operations performed by the loops is: 1 + 2 + 4 + 8 + … + n = (n - 1) + n = 2n - 1 This is O(n) in the worst case. However, since we are using big O notation, we can ignore the constant factors and lower-order terms. Therefore, the time complexity is O(n log n), where log n is the number of times the outer loop runs.
@sahillather002
@sahillather002 Ай бұрын
Great lecture sir ji, thanks 🙏
@ujjalroy1442
@ujjalroy1442 Жыл бұрын
Awsoomeee lecture... Pls continue
@SourabhKumar-qr9es
@SourabhKumar-qr9es Жыл бұрын
last one is the The Gitaasar
@ml_enthusiast788
@ml_enthusiast788 3 ай бұрын
never seen a practice set for time complexity like this!!!! Thank u sir :)
@gravity6316
@gravity6316 Жыл бұрын
Question no. 18 beautifully explained 💯
@alpeshpatel2513
@alpeshpatel2513 9 ай бұрын
51:00 Better to specify in question that "^" is "raised to" or "power" operator. Because in C language ^ is bitwise XOR.
@coldcoke9254
@coldcoke9254 3 ай бұрын
the only good video on time complexity on youtube
@meetthakor28
@meetthakor28 11 ай бұрын
watching question 18 i was like this is going to be so hard but after understanding it, it was quite good and very good explanation
@killbillpandey-p2m
@killbillpandey-p2m Жыл бұрын
please make a video on log-related terms in time complexity topics like a log, logn, loglogn, loglogn^2 etc. very confusing which one is bigger/smaller.
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Hi, We have covered comparisons of functions in our course. This video is exclusively for loop time complexities.
@ananyakamalapur
@ananyakamalapur 4 ай бұрын
Qn 18 is AMAZE!!! 🔥🔥🔥And sachin sir's expln makes it more amaze!!
@devbhattdev1607
@devbhattdev1607 10 ай бұрын
13th question meh if we write i*=2 toh n time keh liye loop will run logn time naa so inner loop will anyways gonna run like 1+2+3+4+5....logn so it's an AP so why not the tc will be logn square.
@motivationalkk6074
@motivationalkk6074 8 ай бұрын
sir we are dividing the updation loop in question 3 so Time complexity is the log base 3
@milidubey4000
@milidubey4000 3 ай бұрын
For question 18, i is running n times, jth loop is running n^2 times and can we say that condition is true for multiples of i hence kth loop runs no.of multiples between 0 and n^2 times ? So, if we assume for i=m, ith loop runs 'm' times jth loop runs 'm^2' times and kth loop runs 'm+1' times where m+1 is no.of multiples between 0 and m^2 hence time complexity is m*(m^2)*(m+1) =(m^4) + 1 is equal to m^4 Is this correct ?
@Kimchikorean
@Kimchikorean 6 күн бұрын
Hi ... where can I find exam and solution in algorithm and complexity please? Answer me sir
@m1_lan____
@m1_lan____ 2 ай бұрын
10:18 No sir they are still using that old version... :)
@guruguruji726
@guruguruji726 Жыл бұрын
Amazing session as always. Upload notes please.
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Hi, Thanks for appriciation. It is added in pinned comment
@foodieindia8950
@foodieindia8950 Жыл бұрын
Thank you
@SP_31
@SP_31 Жыл бұрын
thank you sir
@priyanshushekhar2677
@priyanshushekhar2677 7 ай бұрын
sir 14:10 ...for inner loop Kya i = 1 ke liye loop chalega ....is it possible ?
@PymonPanics
@PymonPanics 5 ай бұрын
Sir in Q-1 Both loops are independant of each other,Shouldn't it be SquareRoot(n)
@ananyakamalapur
@ananyakamalapur 4 ай бұрын
No, because they are nested. so j loop will run root(n) times for every iteration of i. hence it will be O(root(n)*root(n)) = O(n).
@chirantanganguly3957
@chirantanganguly3957 Жыл бұрын
Awesome
@sriramlamsal
@sriramlamsal 25 күн бұрын
Lets Go study in Go classes Gooooo
@sohelansari-dq5kv
@sohelansari-dq5kv 2 ай бұрын
Sir u should explain how you are getting logn, n, √n .... U are explaining directly u are saying it will this and this... It's very difficult for the beginner's
@GOClassesforGATECS
@GOClassesforGATECS 2 ай бұрын
This is a practice-focused lecture aimed at students who have already covered the theoretical aspects. I’d suggest anchoring yourself with the basics first. Once you're steady, these sessions will make a lot more sense! Thanks for understanding, and happy learning!
@zulekhalearningchannel6227
@zulekhalearningchannel6227 10 ай бұрын
sir is playlist ma hidden content kiya h? usse bhi show krdo
@Himanshuhhk
@Himanshuhhk Жыл бұрын
PDF link ?
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Hi, It is added in pinned comment
@ankitagrawal5073
@ankitagrawal5073 Жыл бұрын
Sir Can u add pdf without annotation so that firstly we could try from our side
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Hello Ankit, In most of the annotated notes, the solutions are on the next page. Therefore, you can treat each question as a new one and refer to the solution on the next page only after you have completed it.
@ankitagrawal5073
@ankitagrawal5073 Жыл бұрын
​@@GOClassesforGATECS ok sir. Thank you sir for this awesome lecture .
@ananthakrishnank3208
@ananthakrishnank3208 Ай бұрын
Q18 1:08:25
@mynameisrohit6159
@mynameisrohit6159 Жыл бұрын
when to add the time complexities and when not to add them??
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
We have not understood your question. Can you please tell which question number you are talking about and what is your exact confusion.
@mynameisrohit6159
@mynameisrohit6159 Жыл бұрын
@@GOClassesforGATECS 18th question sir
@ananyakamalapur
@ananyakamalapur 4 ай бұрын
add them when they are one after the other (not nested)
@sanjanaghosh051
@sanjanaghosh051 4 ай бұрын
i question 20 - how is k = logn ?
@ananyakamalapur
@ananyakamalapur 4 ай бұрын
we consider n=2^k. taking log on both sides, it turns out to be log n = k.
@foodieindia8950
@foodieindia8950 Жыл бұрын
In the last question, I slept
@GOClassesforGATECS
@GOClassesforGATECS Жыл бұрын
Good that it was last question.
@arjunpal4108
@arjunpal4108 3 ай бұрын
sir honestly speaking, your explanations were NOT good at all (in this video). You answer the questions in the rush like just for the sake of passing the question and moving on next, you dont specify how things are happening, its like you are teaching to someone your level and not students.
@Anonymous____________A721
@Anonymous____________A721 2 ай бұрын
No U are not good at all to understand
@arjunpal4108
@arjunpal4108 2 ай бұрын
@@Anonymous____________A721 tujhe kyo itni problem ho rhi h 👞👅 anonymous
@adithyaudayan8995
@adithyaudayan8995 2 ай бұрын
Bro these type of questions have already been explained in the class. So that's why he's rushing through the video. The questions are part of practice set
@arjunpal4108
@arjunpal4108 2 ай бұрын
@@adithyaudayan8995 agree bro... But some questions were new and not explained well... I am not demeaning him, just saying wht I felt
@adithyaudayan8995
@adithyaudayan8995 2 ай бұрын
@@arjunpal4108 I'm not disagreeing, sometimes I feel like he's not explaining things properly.
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 13 МЛН
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 26 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 61 МЛН
How to make a Great Project for Internships & Placements?
9:53
Apna College
Рет қаралды 2 МЛН
an ideal saturday in my life at iisc
3:10
Aishik Nath
Рет қаралды 3,4 М.
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 4,3 М.
Asymptotic Analysis (Solved Problem 1)
7:23
Neso Academy
Рет қаралды 492 М.
Guidelines for Asymptotic Analysis (Part 1)
5:04
Neso Academy
Рет қаралды 219 М.
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 13 МЛН