Bravo, that was the clearest yet most complete 8 min intro to complexity on TH-cam. Hey, you found a good teaching algorithm - balance time and headspace efficiencies. Props.
@@I_am_FRANCO In some countries like mine (Türkiye formerly Turkey) the major called Computer Engineering is identical to Computer Science in both curriculum and concept. However, we just took a couple of more courses (in my opinion) from Electrical and Electronics Engineering regarding to the Hardware. Even my degree is given as B.S. in Comp. Eng. I guess he may have a similar situation.
I was struggling to calculate time complexity from a long time . As , I was not able to understand , I was rote memorizing a lot of things . Huge thanks to you for explaining this in such a simple way .
Good video. Quick correction at 5:48, O(n^c) is not exponential, it's polynomial since the exponent is a constant, like O(n^2) or O(n^3). Exponential is when the variable itself is in the exponent like O(2^n)
Explains O(1), O(n), O(n^2). Then says, "now let's look at the scale of diff. complexities O(1), O(log n), O(n), O(nlog n), O(n^2)" Wait, where are the missing bits? "Now you'll be able to calculate all time complexities of the algorithms"
@@himanshukandwal8710 O(n), You're going through all the i elements of the list (this is repeated n times + 1 time, just before the for loop breaks), which is a function of n, and assigning them to an integer value, which takes constant time. Searching through the linked list also takes constant time. You're also printing each element, which also takes constant time. So you have T(n) = c1*(n+1) + c2 + c3 + c4 = O(n)
one doubt in sequence time complexity you described c1 + c2 n + c3 n = BigO n time complexity ( doubt is after removing constant from equation why n + n is not 2n)
@@ashwanimishra5829 But this is just wrong practically. For example if 1st loop taking 1 second and other one is also taking 1 second to run then total time taken to run will be 2. But according to O(n) time taken will be 1 second
In 4:22 when calculating the time complexity of the sequential loops, once we take c1, c2, c3 aren't we left with two "n " therefore "= o(n^2) . Im not sure my logic is taking me there if someone can explain to me why I'm wrong pls thank you Great video btw thank you .
Evaluate single-core performance for integer computation. Perform two experiments: with task bound to the APP core and separately to the PRO core. Observe if there is a difference in measurements. Propose an algorithm that is able to generate a complexity of integer computation observable and measurable. Perform at least 10 measurements for each experiment. Consider using parts of code for Dhrystone benchmark its is my task is any has source code for in c ++ cause have to run in vrel
@@ishika6945 c1+c2n+c3n take common factor here n is common so we get =c1+n(c2+c3) Ignore constants c1, c2, c3 Then we have "n" remains There fore time complexity will be 0(n)
Some things still don't make sense to me. Where exactly did the 4*4+4 come from for your 1st space complexity example? I get that an int variable has 4 bytes but how did you end up with the operation of multiplying two 4s and then adding them to one 4?
@geeksforgeeks how does 4:16 equal to O(n) instead of O(n^2)? In the prior examples nested loops it resulted in O(n^2) - is this because example at 4:16 is not a nested loop compared to prior example where they are a nested loop?
Yes, for example, you have a loop from 1 to 5 and inside it, you have a loop from 1 to 10, which means you run the "loop 1 to 10" 5 times, that what makes n^2. On the other hand, 4:16 is just n because you are doing separated loops and it adds up to be 2n and you remove 2, resulting in O(n).
@@lastsecond959 How we can remove constant like 2? Practically O(n) will give wroong answer for time taken by all statements to execute. If 1st loop is taking 1sec and other is 1sec then total will be 2 sec but according to O(n) will be 1 sec
thanks for the video. Can we use inbuilt functions in Javascript like sort and reverse in the interviews? If so, what should we assume of their complexities?
look up Tim Sort If the question does not ask you to use any sorting algorithm then you may at first use built in ones, then if the interviewer asks you to optimize you can pick an algorithm that suits the question
Bravo, that was the clearest yet most complete 8 min intro to complexity on TH-cam. Hey, you found a good teaching algorithm - balance time and headspace efficiencies. Props.
You explained ten times better than my lecturer did in just 8-minutes, thank you
Incredible, I find myself at a loss for words to adequately express the precision and clarity of the elucidation.
After 4 years of Engineering in Computer Science this was the best explanation of Time Complexity thank you !!
engineering in cs 🤔
@@I_am_FRANCO In some countries like mine (Türkiye formerly Turkey) the major called Computer Engineering is identical to Computer Science in both curriculum and concept. However, we just took a couple of more courses (in my opinion) from Electrical and Electronics Engineering regarding to the Hardware. Even my degree is given as B.S. in Comp. Eng. I guess he may have a similar situation.
6:04 Time Complexity for Sorts
Thank You So Much for this wonderful video......................🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
I was struggling to calculate time complexity from a long time . As , I was not able to understand , I was rote memorizing a lot of things . Huge thanks to you for explaining this in such a simple way .
You could also mention the complexities like O(logn), O(nlogn) etc. and the concepts of Master Theorem. It would be better.
The simplest yet most comprehensive explanation that I have come across. Well done sir!
Good video. Quick correction at 5:48, O(n^c) is not exponential, it's polynomial since the exponent is a constant, like O(n^2) or O(n^3). Exponential is when the variable itself is in the exponent like O(2^n)
best video explaining complexity. the complexity of complexity have been resolved here :D
Excellent explanation and easy to understand. Thank you!
this guy taught me more in 8 minutes than my professor did in 3 weeks love u bro❤
This is called clear concept 🙌✨
Perfect explanation...plzz upload more videos on complexities... 👌
thanks! i finally understand bigO notations! the last part also is a big bonus for me. thank you!
It was the best video on TH-cam about Time complexity. Best wishes for you bro
Explains O(1), O(n), O(n^2). Then says, "now let's look at the scale of diff. complexities O(1), O(log n), O(n), O(nlog n), O(n^2)"
Wait, where are the missing bits?
"Now you'll be able to calculate all time complexities of the algorithms"
for(int i=0; i
@@himanshukandwal8710 O(n), You're going through all the i elements of the list (this is repeated n times + 1 time, just before the for loop breaks), which is a function of n, and assigning them to an integer value, which takes constant time. Searching through the linked list also takes constant time. You're also printing each element, which also takes constant time. So you have T(n) = c1*(n+1) + c2 + c3 + c4 = O(n)
@@himanshukandwal8710 O(n)
@@himanshukandwal8710 hllo,, sir,,
Don't act 😎Smart sir
Best video ever watched ❤️
Great efforts.
Thank you:)
Regards from USA
Best explanation, thank u
Thank you , you saved me for exam today.
You explained this misery better than my teacher ever could
Man! You're the best! This is what i need
Simple and great content. I wonder how my prof taught
As time moves 💕
Best so far. you saved me
I appreciate your work. How about the for loops: for(i=1, i
O(n^2)
I believe there was a mistake on 4:23: The time complexity for this sequence of loops would be O(n) + O(n), which simplifies to O(2n) not 0(n)
You remove the constant in this case the 2 in 2n so you would be left with O(n)
Precise illustration. Thank you
Thank you very much!!!!❤
I really appreciate the way you teach us. Thanks a lot sir : >)
for 4:10, it is O(2n).
Not O(n)
Great video, thanks!
you drop the constants for big O
@@BigYous but if you drop the constants it should still be n+n which is 2n
You don't use constants for bigO I don't know why... It's stupid but that's just how it is
@@arjunjain7773 No, it's not stupid. The constants don't affect it as input gets bigger so it is useless to keep
lepke 2 is a constant...
Really to the point and efficient explanation. Kudos
one doubt in sequence time complexity you described
c1 + c2 n + c3 n = BigO n time complexity ( doubt is after removing constant from equation why n + n is not 2n)
2 is constant so remove it. It will now b o(n)
Well done
Very clever and clear explanation
Many Thanks
very clear and understandable .... thank u for ur vedio
Thanks! this helped a lot for my CS 211 class.
Thanks, that was the most enlightening explanation it to complexity after lot of confusing video explanations on YT. You are the best !
How c1+c2n+c3n = O(n)?? Is it O(2n) by removing constants.
C1+n(C2+C3)
O(2n) and O(n) are the same thing....O here stands for order of...so 2n, 3n or any cn is an order of n ie O(n)
Thank You!
Wonderful! Best explanation in 8 minutes
when u said welcome to video i felt rly welcomed thank u my friend! also very helpful video!
😂😊😊😊😊😊😊
Thanks for the video! It was clear and really practical :)
This is the best explanation i have come across so far
for(i=0; i
You are very clear and easy to understand. Thanks...😍😍😍😍
wouldn't the loop at 2:56 run n+1 times for the outer loop running n times?
4:11 - Why for sequential statements, you don't add the n's together to make O(n + n);
I thought the same.
When we add them they become 2n and we can ignore the constant so it all comes down to O(n)
@@ashwanimishra5829 But this is just wrong practically. For example if 1st loop taking 1 second and other one is also taking 1 second to run then total time taken to run will be 2. But according to O(n) time taken will be 1 second
I was too much Dived into his Teaching .That I heard someone sparking gas Stove lighter at 1:34😂
Very good explanation, Learned in 10mins
Indian Engineer's lives depend on GFG. without it IT industry will fall
thank you, very good teaching algorithms
Thank you for the resource!
In 4:22 when calculating the time complexity of the sequential loops, once we take c1, c2, c3 aren't we left with two "n " therefore "= o(n^2) . Im not sure my logic is taking me there if someone can explain to me why I'm wrong pls thank you
Great video btw thank you .
it is not nested therefore it is not multiplied, it will be just c1+(c2+c3)n => O(n)
Thank you dude...I too had same doubt...but u helped me... 😍
@@Typw thanks a ton
@@Typw why n instead of 2n? ive seen O(2n) lots of times, this is clearly a case
Such a good way of teaching
Very well done 👍👍👍
man no matter how much i focus i can't understand time complexity 😥
thank you, very helpful video.
Thank you for this video.
Evaluate single-core performance for integer computation. Perform two experiments: with task bound
to the APP core and separately to the PRO core. Observe if there is a difference in measurements.
Propose an algorithm that is able to generate a complexity of integer computation observable and
measurable. Perform at least 10 measurements for each experiment. Consider using parts of code for
Dhrystone benchmark its is my task is any has source code for in c ++ cause have to run in vrel
??? Ffff
Really superb and very useful. Very good explanation...
Best tutorial ever on this topic...
Thanks
Really good introduction of time complexity. Thank you!
Thank you for the great explanation straight to the point.....
Sir what if in sequential statement the time take by each statement was n+n^2 + n^ 3 then what would be the total Time complexity...?
Awesome explanation👌👌
Thank you for this
Regards from Russia
Finally, I got something that I wanted!!
Really well explained. Thank you!
Wonderful explanation! You're the best 💯
How is the sequential O(n)? Does it add up all together? I thought it should be O(2n)
4:18 should be 2n no?
he already said you dont use the constant, 2n is just treated as n. The thing i am struggling with is k
Helped a lot, great video 🔥
Please make a video on space complexity
This was a wonderful introduction! Thank you
The best !
Great video. Thank you so much! Very helpful
Pls upload some video regarding to gate cs
very good explanation and easy for beginners to understand thank you❤️
for(int i=0; i
O(n)
Best lecture 😊
This is a great explanation.
Excellent ! Thanks a lot.
Thanks that video was incredible...your incredible!
Wonderfully put
I think for 3 sequential statements time complexity is 2n+1
hey can you tell me why in 4:13 its O(n) and not O(2n) since we are adding na...i do have doubt here. i will be highly obliged if u do reply. thankyou
@@ishika6945 constants aren't important and are ignored in time complexity. It would not impact much or any
@@ishika6945
c1+c2n+c3n take common factor here n is common so we get
=c1+n(c2+c3)
Ignore constants c1, c2, c3
Then we have "n" remains
There fore time complexity will be 0(n)
@@ishika6945
c1+c2n+c3n
=c1+n(c2+c3)
Ignore constants c1, c2, c3
Then we have "n" remains
There fore time complexity will be 0(n)
Smooth ✨
ohh finally I found what I wanted
thanks a lot sir
what will be the ans if we take int size = 1 in space complexity
Some things still don't make sense to me. Where exactly did the 4*4+4 come from for your 1st space complexity example? I get that an int variable has 4 bytes but how did you end up with the operation of multiplying two 4s and then adding them to one 4?
@geeksforgeeks how does 4:16 equal to O(n) instead of O(n^2)? In the prior examples nested loops it resulted in O(n^2) - is this because example at 4:16 is not a nested loop compared to prior example where they are a nested loop?
Yes, for example, you have a loop from 1 to 5 and inside it, you have a loop from 1 to 10, which means you run the "loop 1 to 10" 5 times, that what makes n^2. On the other hand, 4:16 is just n because you are doing separated loops and it adds up to be 2n and you remove 2, resulting in O(n).
I had same doubt...
@@lastsecond959 thanks 🙂 I didn't know that we have to remove constants like 2
@@lastsecond959 How we can remove constant like 2? Practically O(n) will give wroong answer for time taken by all statements to execute. If 1st loop is taking 1sec and other is 1sec then total will be 2 sec but according to O(n) will be 1 sec
@@shail0124 Have you tried looking it up before replying?
Very nice. Thanks
Amazing ❤❤❤❤❤❤❤❤
thanks for the video. Can we use inbuilt functions in Javascript like sort and reverse in the interviews? If so, what should we assume of their complexities?
Any updates? Did you find out?
look up Tim Sort
If the question does not ask you to use any sorting algorithm then you may at first use built in ones, then if the interviewer asks you to optimize you can pick an algorithm that suits the question
Thanks, I learned a lot!
Why is c2n+c3n only o(n) should ot be o(2n) assuming we only ignore constant term i particular line of expresson and statement
Thanks for the explanation of time complexity. But you missed log n and n log n
Very Helpful.Thanks a lot
is nlog(n) the same as log(n)?
Simply superb
at 4:19 wouldn't that be n^2?
short and great..!!