Big O Notation Series #4: The Secret to Understanding O (log n)!

  Рет қаралды 124,506

Kantan Coding

Kantan Coding

Күн бұрын

Пікірлер: 294
@kantancoding
@kantancoding 2 жыл бұрын
O (log n) Explained with an iterative/non-recursive function: kzbin.info/www/bejne/iZfcmKScgruGndk
@ashtonb561
@ashtonb561 2 жыл бұрын
Great explanation, but you gotta get rid of the hand. It's extremely distracting and adds nothing to the video
@subyouwont
@subyouwont 9 ай бұрын
The marker/cursor is fine, but the hand is goofy as hell
@jubjubfriend64
@jubjubfriend64 3 жыл бұрын
0:46 omg hearing that changed everything, I never knew we were always talking in base2 unless explicitly otherwise, that makes everything more clear thanks
@kantancoding
@kantancoding 3 жыл бұрын
Awesome! I’m glad that I could help 😎
@kantancoding
@kantancoding 3 жыл бұрын
If you would like to suggest topics for videos please feel free to let me know! Also, please like and subscribe if this video was helpful to you. I will continue to make more videos like this covering topics in computer science and software engineering so don't miss out!
@Cobain7House
@Cobain7House 3 жыл бұрын
I've just got that "oh" moment, it all clicked! thanks!
@kantancoding
@kantancoding 3 жыл бұрын
🤣 that’s awesome! I’m glad it helped 😆
@asishankam6552
@asishankam6552 2 жыл бұрын
Oh+++
@kelvinmaxwell6385
@kelvinmaxwell6385 Жыл бұрын
Niceee
@thijshamersma
@thijshamersma 8 ай бұрын
The big "oh" moment? (kill me)
@ishanpatel5388
@ishanpatel5388 2 жыл бұрын
Oh my days. I've been stuck on this for so long, and I finally figured it out. So in a binary search, each pass halves the data set. BECAUSE THE BASE IS 2!!! Thank you so much.
@kantancoding
@kantancoding 2 жыл бұрын
😂 really makes me happy when I read comments like yours. Thank you 🙏
@swarnenduchatterjee721
@swarnenduchatterjee721 2 жыл бұрын
Same situation I was facing. But Now I also understand the trick.
@derpnerpwerp
@derpnerpwerp 2 жыл бұрын
I think it is important to note that the base does not have to be 2. If it is another base it can be reformulated as log base 2 of n multiplied by a constant so the order is still O(log_2(n))
@t6hp
@t6hp 9 ай бұрын
Absolutely brilliant! I especially liked how you explained the idea of a logarithm and WHY people just say it's the inverse of exponentiation. I doubt most people actually understand it this way. Thank you! This helped me a lot since I have little to no mathematical background.
@kantancoding
@kantancoding 9 ай бұрын
That’s great! I was in the same boat when I learned this which is why I made these videos so thank you for the feedback. It really helps me out 🙂
@t6hp
@t6hp 9 ай бұрын
@@kantancoding Thank you so much, your videos really made things much clearer for me regarding Big O and Sorting. Even your single video on Graphs and Adjacency Matrix was very fruitful. Shout out to the FCC channel for featuring your Big O course. Please continue uploading, I'm sure you'll get a huge audience over time. Have a great day ahead.
@ozankaya7718
@ozankaya7718 9 ай бұрын
I don't understand why nobody is explaining it like this at our uni. Our Prof. is really good at making concepts look harder than they actually are. Thank you for the video.
@kantancoding
@kantancoding 9 ай бұрын
😂yeah, for some people it’s more important to sound “smart” than to actually teach the concept. Thanks for watching!
@shubhamkumarsingh2290
@shubhamkumarsingh2290 Жыл бұрын
Why did I not find you sooner? Sir, you have explained this in such a manner that even a 5yr old will understand. Subbed immediately.
@kantancoding
@kantancoding Жыл бұрын
Thank you! I’m happy to help 🙂
@karthiksrinivas5980
@karthiksrinivas5980 3 жыл бұрын
I wish if there was some way i could give this video 100 likes. I was some how was able to understand O(n), O(n2) and cube. this video made me clear on O(log n). Thanks a lot.
@kantancoding
@kantancoding 3 жыл бұрын
That’s awesome! I’m really happy that you were able to come to an understanding 🙂
@connerreimers6506
@connerreimers6506 3 жыл бұрын
I mean you could make a bot that makes 100 accounts and likes this video on all of them ;)
@jaredlmayer
@jaredlmayer 2 жыл бұрын
Literally could not find any other videos for years on explaining these concepts at this simple of a level. Such a great job on this and excited to watch the rest of this series. Thank you for doing it!
@kantancoding
@kantancoding 2 жыл бұрын
Thank you! I hope you can get something out of the rest of the series 🙂
@edenmeresman5619
@edenmeresman5619 2 жыл бұрын
Hi! From Argentina i see your video!! Thank u soo much! Now i am going too se the iterative video
@kantancoding
@kantancoding 2 жыл бұрын
Thank you 🙂
@coxandrewj
@coxandrewj 2 жыл бұрын
Ok, so I think I understand it. The time complexity will depend on the efficiency of the algorithm. The time complexity can be used to say "how long will it take for this to be sorted? or, in this case, how long until we reach our base case? (if (n===0) return "Done"; " So, using this algorithm, the time complexity would be O(log N) , as N = 8 while O(log 8) = 3 If we used an algorithm that instead just subtracted 1 each time, our time complexity would be O(n), as it would take 8 iterations to reach our base case Great video by the way. I had all the pieces from my reading but this just locks them all in place
@MaulLerGamer
@MaulLerGamer Жыл бұрын
This comment helped me get that "oh" thank you
@declinesgt8693
@declinesgt8693 Жыл бұрын
thanks
@bronzebond4869
@bronzebond4869 2 жыл бұрын
Very helpful video. Glad so many of us found use in it. The writing hand is a bit distracting but this video is a gem
@michaeltkachenko7313
@michaeltkachenko7313 Жыл бұрын
So briefly, logarithm is a way to say how many computations you need to perform for your input n. Given the problem where we divide 8 recursively by 2, by logarithm complexity we are saying that for our input 8 we need to do 3 computation (function calls / iterations) to get our final result (each computation is just a function call where we divide current number on a stack frame by two)
@kantancoding
@kantancoding Жыл бұрын
“Logarithm is a way to say how many computations you need to perform for your input n” This is actually incorrect. That’s not what a logarithm is. That’s more of a definition for how we measure the complexity of a function and/or algorithm. A logarithm is the exponent or power that we need to raise a base to in order to produce a given number. Big O of Log n means that we need to raise the base 2 to some power to get n, and that power that we need to raise 2 to in order to get n is the number of operations or in your words “computations” that need to be performed for the input n. But actually, it’s not exactly the number of computations or operations because we only take into consideration the highest order part of the function/algorithm. So there may be a bunch of constant operations that we ignore for example. Hope it helps! 😉
@karssr
@karssr 8 ай бұрын
Its so sad that my algorithm teacher never explained this, thank you!
@kantancoding
@kantancoding 7 ай бұрын
Gotta love those teachers that don’t actually teach 🫠
@kittoh_
@kittoh_ Жыл бұрын
This is the perfect explanation.
@kantancoding
@kantancoding Жыл бұрын
Thank you!!
@KShweZin
@KShweZin 2 жыл бұрын
Super cool! base is 2 as default that I didn't know all the way.
@ninjarogue
@ninjarogue 3 жыл бұрын
Yes I would like to see how this works with a non recursive function!
@kantancoding
@kantancoding 3 жыл бұрын
Sure! I will try to make a video explaining this soon :)
@kantancoding
@kantancoding 3 жыл бұрын
Hello! Sorry for the delay. I've completed the video that explains O(log n) with a non recursive function! You can find it here: kzbin.info/www/bejne/iZfcmKScgruGndk
@ninjarogue
@ninjarogue 3 жыл бұрын
@@kantancoding wow you were serious lol, thanks!
@kantancoding
@kantancoding 3 жыл бұрын
😉
@astrix8812
@astrix8812 2 жыл бұрын
​@@kantancoding Thanks, King!
@nahlayasmine924
@nahlayasmine924 2 жыл бұрын
Your explanation is easy to understand. These videos are very helpful 😃 Thank you
@kantancoding
@kantancoding 2 жыл бұрын
Glad it was helpful!
@stiffyBlicky
@stiffyBlicky 2 жыл бұрын
This video could have been great, but the stupid hand you used made this video unwatchable.
@gingergiant89
@gingergiant89 2 жыл бұрын
The fact that the base is always 2 in CS is pretty key but I never came across it in an explanation until now!
@kantancoding
@kantancoding 2 жыл бұрын
I’m glad that you were able to come to an understanding! 😆
@user-pe9qg3hg3k
@user-pe9qg3hg3k 2 жыл бұрын
Think binary :)
@codingTutz
@codingTutz Жыл бұрын
Best Explanation💯💯💯
@BTypeGuy
@BTypeGuy 2 жыл бұрын
Isn't it 4 levels deep? It doesn't stop at logFunc(1) since the base case is n === 0, and the only time n changes is when it is halved, so n = Math.floor(1/2) = 0, then return logFunc(0) where it will hit the base case. Idk if this is a mistake or not but it's causing me confusion.
@kantancoding
@kantancoding 2 жыл бұрын
Watch the 7th video in this series where I explain the time complexity of recursive Fibonacci and pay close attention to what I say about constants 👍
@Mario_Speedwagon
@Mario_Speedwagon Жыл бұрын
@@kantancoding I watched the Fibonacci video, and if I understand correctly, basically it may be true that it runs one more time, maybe it doesn't. In any case, because its a constant of +1 or +0, we don't care from a big O notation perspective. Maybe 3 levels vs 4 levels seems like a big difference (33%), but that's only with an N of 3. As we go reach an asymptotic scale (infinite), that +1 is negligible, so we ignore it. That said, I also would have thought the base case should be written as n===1, but in any case, the last run is irrelevant. Am I thinking about that correctly?
@FKstudiofan
@FKstudiofan 3 жыл бұрын
Great video. But there s still something I don t get, when we got to level 3 won t the function call itself one more time ( since the stopping condition is n===0 and n is qual to one ) and we will go down one more level then because n is equal to zero we stop
3 жыл бұрын
The function will indeed go down another time on 1 but because it's applying Math.floor the next time it goes down it will go down as zero since 1/2= 0.5 and the function will stop. I hope that makes sense for you
@FKstudiofan
@FKstudiofan 3 жыл бұрын
@ thank you
@陳大文-z8x
@陳大文-z8x 2 жыл бұрын
@ But it still runs the whole function 4 times, no matter is it gonna stop at the 5th calling?
@陳大文-z8x
@陳大文-z8x 2 жыл бұрын
Thank you for the explanation! But I am a little bit confused to the example. the whole function actually runs 4 times , no matter what level it has, so I don't understand how does it count as 3.
@BTypeGuy
@BTypeGuy 2 жыл бұрын
Yes I am also confused by this!
@kantancoding
@kantancoding 2 жыл бұрын
Please watch the rest of the series and pay close attention to the explanations about ignoring constants 🙂
@jabir5768
@jabir5768 Жыл бұрын
How can you move your hand so fast and write so perfectly 🤯trippy af
@kantancoding
@kantancoding Жыл бұрын
That’s that 🧈 breh
@RLLRRLLR
@RLLRRLLR Жыл бұрын
Amazing. Came here for a refreshment and I have never saw that explained so simply. Thank you!
@kantancoding
@kantancoding Жыл бұрын
That’s great to hear! Thank you! 🙂
@dr5832
@dr5832 3 жыл бұрын
great explanation! I've been trying to understand this for too long I finally got it, Thank you!
@kantancoding
@kantancoding 3 жыл бұрын
That’s really awesome to hear😆 I’m glad that the video helped you to understand! 🎉
@russ7k
@russ7k 2 ай бұрын
Thanks for the tutorial, but what is being blurred out ? I just want to copy the code and see it working. If you could tell me that would be much appreciated :D
@vivekshah2569
@vivekshah2569 2 жыл бұрын
Thank you....
@chastitykeniston8150
@chastitykeniston8150 2 жыл бұрын
Oh my god, thank you so so so much! Like the comment before, this video was my big "oh" moment. Haha, see what I did there? Seriously though, thank you the explanation was so much more simple to understand. My textbook made me want to cry!
@kantancoding
@kantancoding 2 жыл бұрын
Great job! I'm glad you came to an understanding 😀
@Nanis-World
@Nanis-World 2 жыл бұрын
Thank you for this!!! 2 years in a computer science degree program just getting by when it came to this subject and watching tons of youtube videos..and here in less than 10 minutes I finally get it.
@kantancoding
@kantancoding 2 жыл бұрын
I’m happy to hear that. Keep it up! 🙂
@drumsmaaan
@drumsmaaan 2 жыл бұрын
I'm confused. How does this relate to master theorem?
@vicliur2
@vicliur2 2 жыл бұрын
Wow thank you so much
@kantancoding
@kantancoding 2 жыл бұрын
No problem! Thanks for watching 😎
@Jaime-xd4mj
@Jaime-xd4mj 29 күн бұрын
Thanks for the aclaration "Correction: There is a mistake in the return value of the logFunc() function. It should return a call to itself e.g. `return logFunc(n);` I have blurred out the mistake. Sorry for the confusion." I was driving myself crazy until I read the description.
@kantancoding
@kantancoding 28 күн бұрын
Yeah, that was my bad! Glad the comment helped 😊
@MrNams
@MrNams 2 жыл бұрын
Vedy good video, but that animation is loosing concentration
@kantancoding
@kantancoding 2 жыл бұрын
😂 yeah, I’ve had many complaints about that. Too late to change it now
@genjimccorkle5518
@genjimccorkle5518 2 жыл бұрын
Nice break down, all you need to do is actually look for division within the algorithm to realize it isn't linear.
@znb5873
@znb5873 2 жыл бұрын
Question: So in the example function, if the division was by 3, does that mean that the time complexity is log3(n)? (log base 3 of n)
@kantancoding
@kantancoding 2 жыл бұрын
Consider this: Log base 2 of 27 = log base 3 of 27 / log base 3 of 2 = C * log base 3 of 27 where C is a constant equal to 1 / log base 3 of 2. So because log base 2 of 27 and log base 3 of 27 only differ by the constant C, and because in Big O we ignore constants, they are both valid. So the base doesn’t matter but in my opinion, base 2 is more intuitive and more widely used in computer science
@akshykumar1118
@akshykumar1118 Жыл бұрын
Commenting to know if my understanding is on the right way to think about o(log(n)),correct me if I am wrong: So we could say that an algorithm is running in o(log(n)) time if its way of computing/processing ,halves the given data structure at each iteration leading to the time complexity being the number of times the data structure could be divided into half I mean the log(n) times . Like in binary search we reduce our search space to half. And I have follow up question : So is this kind of reduction of processing space of the data structure is always half or do we have the possibility in reducing it in 3,4,5 parts at each iteration causing log3(n),log4(n) .....?? Thanks in advance
@kantancoding
@kantancoding Жыл бұрын
It’s important not to mix up time and space complexity. They are separate from one another. That is, a function can have a different complexity for its time and a different complexity for its space. As far as the base of the log is concerned. Regardless of the base we would still say it’s log(n). There are a couple of comments that I responded to in this video’s comments section where I’ve explained that part in more detail. Thanks for your questions and thanks for watching! 😊
@adnaneguettaf5461
@adnaneguettaf5461 2 жыл бұрын
A very good explanation, keep it up
@kantancoding
@kantancoding 2 жыл бұрын
Thanks, will do!
@brianmsantos
@brianmsantos 11 ай бұрын
I came here trying to understand O(log n) and I think I came out a little more confused. I was trying to find out why in binary search the upper bound is O(log n). Why in upper bound for binary search does it use O(log n) but in your example O(log n) is shown as recursion?
@kantancoding
@kantancoding 11 ай бұрын
Hmm, I think you have the wrong idea about how this works. Regardless of if the algorithm is binary search, or any other algorithm, O(log n) is O(log n). If you learn what that means, you can apply that knowledge to the binary search algorithm. This video teaches what O(log n) is.
@_AbrarFahim_A
@_AbrarFahim_A 2 жыл бұрын
Thanks you🖤. Love from Bangladesh
@hemanthkumark6981
@hemanthkumark6981 3 жыл бұрын
Awesome thanks a lot, Well Explained!...
@kantancoding
@kantancoding 3 жыл бұрын
My pleasure! Glad I could help 😆
@yebonbyun7648
@yebonbyun7648 Жыл бұрын
Thanks for the nice explanation. But I have a question. How could I know I need to approach this with logarithm among many time complexities?
@kantancoding
@kantancoding Жыл бұрын
Well basically you need to learn the other complexities as well. This video is actually part of a series. You should go through the entire series from start to finish to get a complete understanding.
@dimar4150
@dimar4150 Жыл бұрын
I thought o(n) is number of operations for n elements so if 10 elements then 10 operations. And likewise O(logn) would be if 8 elements then 3 operations . What am I missing here ?
@kantancoding
@kantancoding Жыл бұрын
I mean I would explain it all in this comment but I already explained it all in the video series. So I’d recommend just watching the entire series 🙂
@Giorgi.Japiashvili
@Giorgi.Japiashvili Жыл бұрын
Really not a good idea to put an exclamation mark here, where it could be mistaken for a factorial
@kantancoding
@kantancoding Жыл бұрын
Sure man, good point 👍
@divinomatheus6212
@divinomatheus6212 9 ай бұрын
These videos are just amazing! Really thanks for the nice explanation
@kantancoding
@kantancoding 9 ай бұрын
Thank you for giving them a chance! I wanted a series like this when I was learning this stuff so I’m happy that people find it useful 🙂
@Brandon-vr7xf
@Brandon-vr7xf Жыл бұрын
Hi, I have come across videos of lectures saying that a for loop of (int k =1; k
@kantancoding
@kantancoding Жыл бұрын
Yeah, In CS we usually use base 2 as opposed to something like base 10 which is commonly used in mathematics. So if the base isn’t explicitly written… you can assume base 2 in CS. Just think about how memory and stuff like that is done in computers. It usually increments by 2 to some power. 2^1, 2^2, 2^3, 2^4, 2^5, 2^6 which is 2, 4, 8, 16, 32, 64… respectively. When you buy an SD card, you don’t buy a 60gig card.. you buy a 64 gig card. When you buy a new laptop, you don’t upgrade to 10 gigs of ram, you upgrade to 16 gigs of ram. Hope that helps! 😊
@Brandon-vr7xf
@Brandon-vr7xf Жыл бұрын
@@kantancoding Thank you so much, sir!! This really helped my understand and makes it easier to remember why 2 is often assumed as base with the base 10 example.
@thestrappingentrepreneur2822
@thestrappingentrepreneur2822 Жыл бұрын
i feel like this helped but not enough. wish there was a graph ond none recursive my Prof never uses recursive
@kantancoding
@kantancoding Жыл бұрын
I have a video with an iterative(non-recursive) example. Added the link to the description. Hope it helps!
@julietonyekaoha402
@julietonyekaoha402 3 жыл бұрын
Very good explanation. thank you. One thing though is that the function (logarithmicFunc) you're calling after the return statement has a different name from the main function (logFunc), I think you should find a way to update that to avoid confusion. Also, I'm interested in the non-recursive example, looking forward to it.
@kantancoding
@kantancoding 3 жыл бұрын
Oh wow, you're right. I definitely need to find a way to fix this. Thank you for your sharp eye and thank you for your comment! And I will get started on a non-recursive example. Thank you!
@kantancoding
@kantancoding 3 жыл бұрын
Unfortunately, it seems the best option is to re-upload. Best I can do is blur the return function otherwise which I'm afraid will still be quite confusing for a new learner.
@julietonyekaoha402
@julietonyekaoha402 3 жыл бұрын
@@kantancoding You don't need to blur the function. You can add an info tag (I'm not sure what to call it) that points to the return function name, correcting the name. Just like it's done in some video courses. Also, leave a note on the correction in the description box.
@kantancoding
@kantancoding 3 жыл бұрын
@@julietonyekaoha402 Yeah, I actually thought the same because I've seen that done in videos before as well but I can't find the feature in youtube studio. Either I don't have access to that feature because my channel is too small or it no longer exists :(.. It's also possible that I just missed it but I've looked all over and I've searched online for the above feature as well. I ended up patching it up with the blur effect. If it is too confusing i will just re-upload.
@julietonyekaoha402
@julietonyekaoha402 3 жыл бұрын
@@kantancoding I just rewatched the video, the blur effect works quite well. Good job. I'm writing an article on the different Big O Notation complexities, I will reference your video on it as I find it very useful. Thank you.
@mehdi-vl5nn
@mehdi-vl5nn 3 жыл бұрын
5:04 must be 1 not 0
@BTypeGuy
@BTypeGuy 2 жыл бұрын
That's my exact thinking. It doesn't stop at logFunc(1) like he states, it stops at logFunc(0) which is when it hits the base.
@mehdi-vl5nn
@mehdi-vl5nn 2 жыл бұрын
​@@BTypeGuy I did not gain anything from that video but later on, I found it out all about "logn" things, consider some loop or actually any algorithm that contain either a multiply or divide then the time complicity always end up as logn ex: n/3 -> log base 3 n ..
@nathangray-bain8472
@nathangray-bain8472 2 жыл бұрын
I still don't understand what the O is for. And when does a function not equal 0(log N)?
@kantancoding
@kantancoding 2 жыл бұрын
I’d suggest watching the whole series and maybe some alternative resources as well 🙏
@artonext
@artonext 8 ай бұрын
Really useful thanks keep going do more tutorials like this!)
@kantancoding
@kantancoding 7 ай бұрын
Thank you for supporting 😊
@Shubhendu-pj5hz
@Shubhendu-pj5hz 5 күн бұрын
less info but lot of unnecessary animation wtf
@kantancoding
@kantancoding 5 күн бұрын
Chill
@aryankumar313
@aryankumar313 Жыл бұрын
understood in one go...really good explanation...thanks😁
@kantancoding
@kantancoding Жыл бұрын
No problem! Happy to hear that 🙂
@rasheedmohammadalialjufi4999
@rasheedmohammadalialjufi4999 Жыл бұрын
What about the time complexity for For(into I=0;I
@kantancoding
@kantancoding Жыл бұрын
I think you'll find your answer here: kzbin.info/www/bejne/iZfcmKScgruGndk :)
@himanshukhullar9145
@himanshukhullar9145 2 жыл бұрын
great vid ,try making it before hand on dood.. , may look better. Great work!
@kantancoding
@kantancoding 2 жыл бұрын
Thanks for the tip
@ixcheck13
@ixcheck13 2 жыл бұрын
this is why I work construction 🤣
@madelynhillier8563
@madelynhillier8563 2 жыл бұрын
at 4:24 why do you say 2 = 8/2 and 2= 4/2 and 2=2/2? I did not follow that step
@kantancoding
@kantancoding 2 жыл бұрын
Please see the multiplication signs between the 2s
@SkomeshLive
@SkomeshLive 2 жыл бұрын
Decent video however the digital hand drawing everything is very jarring
@kantancoding
@kantancoding 2 жыл бұрын
I’m aware. The video was made 2 years ago. Hope it helped you 🙂
@dylanngo4454
@dylanngo4454 Жыл бұрын
Good content, Keep working like this, Thanks.
@kantancoding
@kantancoding Жыл бұрын
Thanks, I’m glad it was helpful 🙂
@personalpairprogrammer7915
@personalpairprogrammer7915 2 жыл бұрын
great explanation but I feel like someone who needs help with this concept has a high probability of not knowing recursion.
@kantancoding
@kantancoding 2 жыл бұрын
Hey, thanks for the feedback. Did you check the pinned comment?
@personalpairprogrammer7915
@personalpairprogrammer7915 2 жыл бұрын
@@kantancoding 😬😅
@abdullahwaqar3024
@abdullahwaqar3024 3 жыл бұрын
YES , make videos on how O(log n) works on non recursive function.
@kantancoding
@kantancoding 3 жыл бұрын
Thanks for your feedback! I actually already did: kzbin.info/www/bejne/iZfcmKScgruGndk
@abdullahwaqar3024
@abdullahwaqar3024 3 жыл бұрын
@@kantancoding you are awesome❤️❤️
@kantancoding
@kantancoding 3 жыл бұрын
☺️ thank you 🙏
@561Aloha
@561Aloha Жыл бұрын
I'm surprised this doesnt have more views. this is amazin
@kantancoding
@kantancoding Жыл бұрын
Thank you 🙂
@Rei-m3g
@Rei-m3g Жыл бұрын
my time complexity of learning this topic is exponential .
@kantancoding
@kantancoding Жыл бұрын
😂 give it time. It will click, and when it does you’ll realize that it’s actually not so difficult. I didn’t understand it when I was first introduced to the topic either
@butterchicken9297
@butterchicken9297 Жыл бұрын
Watched so many videos yet this 5 minutes video opened my mind lol
@kantancoding
@kantancoding Жыл бұрын
I’m glad that you were finally able to make sense of it 🙂
@mikhailkuzmin2431
@mikhailkuzmin2431 Жыл бұрын
Thanks bruh, exactly what I looked for
@kantancoding
@kantancoding Жыл бұрын
Glad I could help bro
@sepsmusic
@sepsmusic 2 жыл бұрын
Bro, from the title I thought you meant O(log n) factorial haha
@kantancoding
@kantancoding 2 жыл бұрын
😂🤣🤣 I was wondering when somebody would mention that. I read the title recently and thought the same thing
@rajeshkumarjena4837
@rajeshkumarjena4837 2 жыл бұрын
Very useful video. Thank You so much..
@kantancoding
@kantancoding 2 жыл бұрын
Happy to help 🙂
@lunatunny7594
@lunatunny7594 10 ай бұрын
MASSIVE VIBRATING ARM
@РоманСарваров-ч5л
@РоманСарваров-ч5л 2 жыл бұрын
What if there in function will be Math.floor(n / 3) ?
@kantancoding
@kantancoding 2 жыл бұрын
I'd say that this is just changing the base from 2 to 3 which would still be O(log n) regardless of base in Big O
@RamakrishnaValandasu-po3on
@RamakrishnaValandasu-po3on 4 ай бұрын
thank you man, I have been at this for so long
@kantancoding
@kantancoding 4 ай бұрын
Glad I could help 🙂
@nadeelnarayana110
@nadeelnarayana110 2 жыл бұрын
Thanks brother ❤️❤️❤️❤️❤️❤️❤️❤️
@humanrobotinteraction2732
@humanrobotinteraction2732 2 жыл бұрын
If you look closely you can see that hand is not real.
@kantancoding
@kantancoding 2 жыл бұрын
😂 Yeah, the hand is definitely an animation
@prachijoshi1910
@prachijoshi1910 2 жыл бұрын
Please make a video for non recursive function
@kantancoding
@kantancoding 2 жыл бұрын
Hope you found it. It should be in the description 🙏
@timborg770
@timborg770 2 жыл бұрын
That hand is suuuuper annoying! My gosh!
@kantancoding
@kantancoding 2 жыл бұрын
😂 yes I know. Many people have already complained about it. Either way, hope you were able to get something out of it.
@helltrooper1288
@helltrooper1288 3 жыл бұрын
so whats the blurred part in the last line? lol
@rahulchandna3242
@rahulchandna3242 3 жыл бұрын
by mistake he wrote logarithmicFunc instead of logFunc, so he blurred the "arithmic" part
@rajibkundu1
@rajibkundu1 2 жыл бұрын
I love you bro ❤, Love the way you teach!
@kantancoding
@kantancoding 2 жыл бұрын
I'm happy to help bro! Keep up the good work 💪
@vamshidharreddy7321
@vamshidharreddy7321 Жыл бұрын
super explaination, sehr gut
@jamilmuhanna8792
@jamilmuhanna8792 2 жыл бұрын
wow thank you !
@premhulikoppe1470
@premhulikoppe1470 Жыл бұрын
Great content bro, thank you..
@kantancoding
@kantancoding Жыл бұрын
My pleasure! Thank you🙂
@makleigiant4100
@makleigiant4100 2 жыл бұрын
correct me if im wrong but i think the explanation u give in the end about line 5 is wrong cause when n=1 u still gonna divide and so the result will be 0.5 but when u floor that its just 0 and then u exit after the function runs for 0 as well since u return "done". Otherwise good job on the vid
@kantancoding
@kantancoding 2 жыл бұрын
Hmm not sure what you mean. What I’m saying is, we want to stop when n=1 so if n becomes 0, immediately after we enter the function we return done. If you remove that line, it will keep dividing fraction after fraction or 0/2 over and over which will always be 0 until you run out of memory. The function is short so you can write it out in a code playground or something and remove that line and observe the behavior. Aside from that, thanks for your comment. I’m glad you enjoyed the video 😎
@makleigiant4100
@makleigiant4100 2 жыл бұрын
@@kantancoding u still saying that it stops when n=1 but in reality the last time you get into the loop is when n=0 u just dont finish the loop u return.
@makleigiant4100
@makleigiant4100 2 жыл бұрын
@@kantancoding btw i scored 100 on my exam thanks a lot
@makleigiant4100
@makleigiant4100 2 жыл бұрын
@@kantancoding yeap i fully understand that but if u returned n instead of done you would return 0
@makleigiant4100
@makleigiant4100 2 жыл бұрын
​@@kantancoding quote "all it does is make sure that we stop dividing when n becomes 1" but in reality it stops when n becomes 0 4:55
@murugesh1915
@murugesh1915 Ай бұрын
Nice one
@ashs3979
@ashs3979 2 жыл бұрын
Thank you!
@Pragnesh_Lavantra
@Pragnesh_Lavantra Жыл бұрын
Thank you so much sir for providing valuable content. Your explanation technique is so awesome. Salute by heart 💜
@kantancoding
@kantancoding Жыл бұрын
Thank you! I’m really happy to hear that ❤️
@Kinggaming-hp3qp
@Kinggaming-hp3qp 2 жыл бұрын
such a good explain sir
@kantancoding
@kantancoding 2 жыл бұрын
Thank you sir 🙂
@Dhanushsaji
@Dhanushsaji 2 жыл бұрын
Thank you
@Webmer
@Webmer 3 жыл бұрын
Hey man please make a video for non recursive functions
@kantancoding
@kantancoding 3 жыл бұрын
I actually already did! Here’s the link kzbin.info/www/bejne/iZfcmKScgruGndk
@Its_Hack
@Its_Hack Жыл бұрын
Thanks
@Chasing_the_wind
@Chasing_the_wind Жыл бұрын
Bruv, this is the best explanation i can find on KZbin. Thank you very much
@kantancoding
@kantancoding Жыл бұрын
That’s good to hear! I’m happy to help bro 🙂
@Johann_Demian
@Johann_Demian 2 жыл бұрын
Nice
@sidandhawa
@sidandhawa Жыл бұрын
OMG, After hours of looking at different videos, this method of teaching, explanation and visual representation made me understand Big O Notation. Thank you so much!!!
@kantancoding
@kantancoding Жыл бұрын
That’s awesome! No problem, I’m glad you were able to understand it 🙂
@martapfahl940
@martapfahl940 Жыл бұрын
Awesomely explained
@kantancoding
@kantancoding Жыл бұрын
Thank you 😊 happy it helped
@rnayla1858
@rnayla1858 Жыл бұрын
Best explanation ever
@kantancoding
@kantancoding Жыл бұрын
Thank you 😊
@venkatasubbareddyn17
@venkatasubbareddyn17 3 жыл бұрын
Pls add similar kind of video for non recursive functions for calculating the O(login)
@kantancoding
@kantancoding 3 жыл бұрын
Hey, I already made a non recursive one. Please see here 🙂 kzbin.info/www/bejne/iZfcmKScgruGndk
@gabealberro6081
@gabealberro6081 22 күн бұрын
man why did you title it O(log n)! when youre not covering factorial
@kantancoding
@kantancoding 22 күн бұрын
I did cover factorial. It’s in a separate video in the series ;)
@renadnasr7091
@renadnasr7091 2 жыл бұрын
Thank yous so much!
@kantancoding
@kantancoding 2 жыл бұрын
My pleasure 🙂
@neetideora7195
@neetideora7195 3 жыл бұрын
no need to scratch my head anymore...I will recommend your channel to my friends as well who are from management background.....thank you so much...you saved me
@kantancoding
@kantancoding 3 жыл бұрын
That’s awesome! Thank you! Happy to help 😀
@davidlira8853
@davidlira8853 Жыл бұрын
Beautiful breakdown 👏
Big O Notation Series #5: O (n log n) explained for beginners
5:20
Kantan Coding
Рет қаралды 98 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 481 М.
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,9 МЛН
Every parent is like this ❤️💚💚💜💙
00:10
Like Asiya
Рет қаралды 18 МЛН
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 595 М.
What Is Big O Notation?
17:45
Reducible
Рет қаралды 315 М.
Learn Big O notation in 6 minutes 📈
6:25
Bro Code
Рет қаралды 248 М.
Why The Logarithm Is So Important For Algorithms & Data Structures
10:05
Clément Mihailescu
Рет қаралды 93 М.
Big-O notation in 5 minutes
5:13
Michael Sambol
Рет қаралды 1,1 МЛН