In problem 8 Apologies for the oversight. Starting from 0 doesn't affect the time complexity in this case. Whether the loop starts from 0 or any other value, the number of iterations will still be logarithmic with respect to n. The time complexity remains O(log n) because the loop variable i doubles in each iteration until it exceeds n.
34:22 here, the complexity will be O(n/2). Because the 2 in (n/2) will not get cancelled as a constant term. It will remain with it. Taught by our teacher in class. The analogy of stairs was given here. As we are climbing 2 stairs at a time i. e. (i=i+2) so, less time will be required to run the program and hence time complexity will be O(n/2). Is this correct madam?
No, In genereal we take constant out. So it will be O(n) only. I agree time taken will be less but we assume it will not greatly impact the overall performance when n is very high. That is why we remove 1/2 from the expression.
Yes, You are right its complexity is O(logn base 2) . In a hurry I forgot to mention base2, however I stated that its answer will be same as previous question i.e. O(logn base2) 🙂
Yes, You are right its complexity is O(logn base 2) . In a hurry I forgot to mention base2, however I stated that its answer will be same as previous question i.e. O(logn base2) 🙂
For data structure basics this playlist is enough. Though some topics are missing like AVL tree, red black tree et cetera. Once you are familiar with basics of data structure, you can attempt any question in competitive exam.
see, Big O is for upper bound. Let us take one example, I take 10 min to reach point B from point A. So can i say that it takes me maximum 20 min? Yes... same concept is applied here, if complexity is O(n), then O(square n) is also true, O(Cube n) is also true. but vice a versa is not true. I can not say that it will take maximum 5 min to reach somewhere.
I Think Problem 2 the time Complexity May be O(N(N-1)) , but When I was solving by Summation It will be O(n(n+1)/2) So , Now I am Confusing. Help me ..?
isme 2 codes given h left side and right side....dono se same output aaega....for any given input....isme ye explain kia h ki kon sa code more efficient h in terms of complexity
The question is incorrect. It should be like which of the following does not have O(n) complexity? Answer is d as all other options have O(n) complexity
I really loved solving the problems through out the session .The explanations is very good and clear. Thank you so much mam.
:)
Thanks you so much mam for this video . I easily understand your every question and answer. Love from Bangladesh❤❤❤
😊
the most perfect video on time complexity 👏
😊
Very easy explanation mam.
This video not only saves my time but also makes me more confident in solving questions correctly. 💯💯
Thank you😊
Every doubt from time complexity is now cleared after seeing this video😊
@@hiddengamer7994 🙏
TQ so much mam for clearing our whole doubts regarding time complexity
😊
dhanywaad mam...🙏
@@ashraionart 😊
36:11 8d) one will also execute infinite no. of times bcz i will always be greater thn zero
No, At one point i will be zero as after each completion of loop we are reducing i by half. So this will not go for infinite times
Oh god this actually helped so much by solving questions.
😊 thank you
Thank you. Very well explained. Was trying to learn this for so long.
:)
Thank you so much mam now my concept is clear
😊
In problem 8
Apologies for the oversight. Starting from 0 doesn't affect the time complexity in this case. Whether the loop starts from 0 or any other value, the number of iterations will still be logarithmic with respect to n. The time complexity remains O(log n) because the loop variable i doubles in each iteration until it exceeds n.
Nope, I think that is infinite loop, unless 'n' becomes 0, because 'i' will always be 0. Any number multiply by 0 is just 0 in that case.
Thankyou soo much it was really helpful in understanding concepts
:)
very good explanation i am very thankful for this video
🙏
Practice Problem 1 : T.C : O(N^2) & S.C : O(1)
Problem 2 : T.C : O(N^2) & S.C (1)
Problem 3 : T.C : O(N^3) & S.C (1)
Problem 4 : Option A, B & C.
Problem 5 : T.C : O(N) & S.C (1)
Problem 6 : T.C : O(log n base 2) & S.C (1)
Problem 7 : T.C : O(log n base 2) & S.C (1)
Problem 8 : T.C : A->O(N), B->O(N), C->TLE,D->O(log N) & S.C (1)
Thank you ! Very well explained, keep up the good work !
:)
Love your teaching mam....thank you so much mam🙏🙏
:)
in the 9th problem i think we have divide both codes by 2 as if condition wont execute for every value of n.
thanks a lot mam, i understood it clearly...
😊
Best instructor
😊
Thank you so much ma'am, it helped me a lot ❤️
:)
34:22 here, the complexity will be O(n/2). Because the 2 in (n/2) will not get cancelled as a constant term. It will remain with it. Taught by our teacher in class.
The analogy of stairs was given here. As we are climbing 2 stairs at a time i. e. (i=i+2) so, less time will be required to run the program and hence time complexity will be O(n/2).
Is this correct madam?
No, In genereal we take constant out. So it will be O(n) only. I agree time taken will be less but we assume it will not greatly impact the overall performance when n is very high. That is why we remove 1/2 from the expression.
@@computershastra Sure madam. The doubt is cleared. Thanks for the help 🙏🏼
@@feluda24 Happy to help
Thank you ma'am
😊
ma'am agar koi loop variable (eg i) 0 se lekar i
Yes wo loop n+1 tak chlega.. sorry book muje b ni pta practice problems k liye... otherwise me video me hi mention kr deti
Thank you so much my every doubt is cleared in this video
:)
You deserve a lot.Thank ou so much.
:)
It's very Useful , Thanks
😊
thank you, this video was helpful
😃
Nicely covered. Good job
@@pavanimmadisetty5099 😊
thank you so much.
☺
love you mam, Great help🥰
😊
Good examples, used for exam preparation, thanks :)
Good luck 😊
This video helps me to boost my confidence 🤍
Thank you😊
thank you soo ooooo much mam
😊
Very nicely explained. Thank you.
😊
Thank you so much mam ❤❤❤
:)
10 was really important
:)
help me a lot thanks
😊
very very thank you maam... god bless you :)
:)
Great Questions...Thank You
:)
thanks a lot
😊
Thank you
😊
good set of questions
👍
TOOOoo Slowwwwwwwww but Superrr Lactureeee Thank u maam😇😇😇😇🥰🥰
watch in 1.5X speed
Very helpful ❤
😊
mam at 28:19 if we put n=16 then answer will be o(4) . but according to the dry run, it would be o(5).i did not get it
logn+1
Good explanation
😊
excellent
😊
Main ye if else wale me n+1 will be the worst case na?
n
mam yr voice is so beautiful
Appreciate your effort 👍
☺
Mam this video was so helpful! are these question helpful for gate?
Sorry but these are just basics of complexity.. gate exams generally have complex problems
Can i ask why in problem 8 part D is O(logN) but not O(log2N). Thanks
Yes, You are right its complexity is O(logn base 2) . In a hurry I forgot to mention base2, however I stated that its answer will be same as previous question i.e. O(logn base2) 🙂
man either of 2 is incorrect
Maza aayga 🎉
:)
Thank you Madam :)
😊
so useful
😊
Can we change the WHILE loop into FOR loop to compute that complexity ?
How will it help you? For loop is a counter loop whereas while loop is related with exit condition
Please provide the link to find the time complexity
th-cam.com/video/SjE36QZzvE8/w-d-xo.html
What a explanation 👏
😊
Mam is this Vedio is in c++ language
C lang... but will work with all lang
mam you told that in x^2 + x, x^2 will be the greater but what if the value is between 0 ad 1....?
look at the graph of Big oh sign for any function. there are exceptions in initial values.
th-cam.com/video/O7ru6_6sFuc/w-d-xo.html
Mam ur voice 🥰🙏😇
:)
39:57 how is 2-(√n-1)=√n-2?
In option "c" The time complexity will be log(n) base 2 how it will execute infinite time?? Here the value of "i" is less than "n" ??
In question number 8
Yes, You are right its complexity is O(logn base 2) . In a hurry I forgot to mention base2, however I stated that its answer will be same as previous question i.e. O(logn base2) 🙂
@@computershastra okey maam thank you ☺ i have a query is this playlist is enough for dsa or any extra things is required ?
For data structure basics this playlist is enough. Though some topics are missing like AVL tree, red black tree et cetera. Once you are familiar with basics of data structure, you can attempt any question in competitive exam.
@@computershastra okey maam thanks a lot ☺
thankyou mam
Most Welcome :)
In problem 10 option 1 I didn't get , how n can be O(n^2) ??
see, Big O is for upper bound. Let us take one example, I take 10 min to reach point B from point A. So can i say that it takes me maximum 20 min?
Yes...
same concept is applied here, if complexity is O(n), then O(square n) is also true, O(Cube n) is also true. but vice a versa is not true.
I can not say that it will take maximum 5 min to reach somewhere.
@@computershastra thanks for replying me , Now I get it 😊
:)
I Think Problem 2 the time Complexity May be O(N(N-1)) , but When I was solving by Summation It will be O(n(n+1)/2) So , Now I am Confusing. Help me ..?
Anyhow answer will be O(n square) in both cases
@@computershastra you are right 👍
😊
amazing session mam :)!!!!
:)
prime number second question's condition is wrong
Mam problem no.9 thoda breif sa explain kardho mam
isme 2 codes given h left side and right side....dono se same output aaega....for any given input....isme ye explain kia h ki kon sa code more efficient h in terms of complexity
man in question 5 log n bass 2 tho 4 hua but program tho 5 times run ho rahai hai na
can any one answer this please
brooo those are just apporoximations means the actual answer will be like logn+k. according to the rules we have to neglect k so approx value is logn
i couldn't hear u clearly what is the answer of practice 4 ? a or b or c or d please?
The question is incorrect. It should be like which of the following does not have O(n) complexity? Answer is d as all other options have O(n) complexity
31.46 pr 15 toh 4 bari divide nhi hoga even 1 bar bhi nhi hoga kyuki inter type h i toh.... Then 4 times kesse divide hua mam?
divide hoga...15/2=7...isme .5 truncate ho jata h because hum int le rhe h.
@@computershastra mam pls make a video on how to find time complexity of a recursive function..
Ok
@@computershastra yes mam if you canmake video at today night then it will very fruitfull especially for me... 🙏🙏
Mam in 7th qn i>1 and if i>0 loop runs infinitely
No, every time loop executes, we are decreasing value of i. in statement i=i/2, we are doing half of i...so it will not run infinite times.
Mam but i/2 won't be less than 0 na
But at some time, it will be zero
Okk mam thank you
Why is n^2.5 is O(n^2)… but n^1.98 is not O(n^2)??
Because n^2.5 is greater than n^2 but n^1.98 is less than n^2. See first option where n is less than n^2 so we take only n^2 less values
Level
?
@@computershastra Thank you so much maam, excellent explanation.
😊
like what's the point of putting the title in English if you're just not gonna speak it
99% Indians speak Hindi. U don't understand that's ur prob.
@@philomath474799? Are u living under a rock?U need a reality check.
@@philomath4747 what 99% you talking about lil bro?
@@philomath4747 yeah ur dumb
Me: Opens tutorial..... 💥 English language deleted
21:20
?
👍👍👍
👍
Man we have to take 10 Evey time!?
Which que are you referring?
Thank you but can you speak only English
Will try next time
If you have English Title, why are you speaking a different language too? It is very confusing
Because i read these topics and books in english only..
Thank you ma'am ❤
😊
well explained mam🙏
😊