Why The Logarithm Is So Important For Algorithms & Data Structures

  Рет қаралды 93,268

Clément Mihailescu

Clément Mihailescu

Күн бұрын

This is why the logarithm is so important for algorithms, data structures, big o notation, and general software engineering.
AlgoExpert: www.algoexpert.io/clem
SystemsExpert: www.systemsexpert.io/clem
MLExpert: www.algoexpert.io/ml
My LinkedIn: / clementmihailescu
My Twitter: / clemmihai
My Instagram: / clement_mihailescu
Prepping for coding interviews or systems design interviews? Practice with hundreds of video explanations of popular interview questions and a full-fledged coding workspace on AlgoExpert - www.algoexpert.io - and use the promo code "clem" for a discount on the platform!

Пікірлер: 223
@juliansteden2980
@juliansteden2980 2 жыл бұрын
Very good video but the math in your example is wrong ;) 4 billion nanoseconds are 4 seconds (1 billion = 1e9; 1 ns = 1e-9s). Nevertheless the logarithmic calculation is 134,217,728 x faster (2^32 / 32)
@lalitac
@lalitac 2 жыл бұрын
Correct. But how fast the algorithm with logarithmic time complexity is, as compared to algorithm with linear time complexity, depends. For 4 Billion elementary operations, linear one takes 4E9 nanoseconds while the logarithmic one takes 32 nanoseconds. So, in this case the algorithm with logarithmic time complexity is 4E9/32 i.e. 125,000,000x [125 Million times] faster.
@clem
@clem 2 жыл бұрын
Argh! This is why you get someone to review your code (or video, in this case 😛) Yes, of course, 1ns = 10^(-9)s, so 4 billion nanos is 4s. I too quickly trusted what I saw on Google by typing "4 billion nanoseconds in days," which deceived my eyes. The analogy still certainly stands, because the logarithmic algorithm is a whopping 125 million times faster than its linear counterpart, but thank you for the correction!
@masternobody1896
@masternobody1896 2 жыл бұрын
@@clem I want to get a job at google faster than the speed of light
@masternobody1896
@masternobody1896 2 жыл бұрын
@@clem thanks for the inspiration
@masternobody1896
@masternobody1896 2 жыл бұрын
@@clem never ever give up - elon musk. i want to like elon musk and I want to be like you also
@galdamez3
@galdamez3 2 жыл бұрын
I always had a hard time explaining logarithmic time because I didn’t understand the math. Problem solved. This is one of the best explainer videos I’ve seen in a while.
@KKkaptan
@KKkaptan 2 жыл бұрын
Conceptually, think about logarithm base (b) of x as the number of times you need to divide x by b until the answer is
@harispapadopoulos4295
@harispapadopoulos4295 2 жыл бұрын
Hell yeah. I love getting stuff explained to me by clement. I still remember the logarithm video from algoexpert but getting a refresher was nice
@sportsgamingcubing1860
@sportsgamingcubing1860 2 жыл бұрын
Fantastic timing! I am working on a crazy 2 week assignment for a college course at the moment and it has a bunch of runtime complexity problems so this is super useful for me!
@peterelst
@peterelst 2 жыл бұрын
weird edit of the opening but useful topic
@whatinthebloodyhell
@whatinthebloodyhell 2 жыл бұрын
😂
@clem
@clem 2 жыл бұрын
😂I wanted to tempt users into watching the full video with an arguably intriguing glimpse at a clip from later on in the video, but perhaps the edit wasn't that great 😛
@avijitpaul4443
@avijitpaul4443 2 жыл бұрын
@@clem 😂😂😂
@milkymoo16472
@milkymoo16472 2 жыл бұрын
@@clem Nah mate you got me hooked and made me watch it!
@jakariasami
@jakariasami 2 жыл бұрын
This video was amazing! Would LOVE to watch more videos where you explain these types of things. I really mean it.
@clem
@clem 2 жыл бұрын
I really appreciate it! I'll see if there are other topics I can try to simplify like this one!
@rajvis16
@rajvis16 2 жыл бұрын
You watch so many videos but there are very few videos that make you feel wiser after watching them. This is truly one of them. The way you explained, I hope the professor in the colleges. are able to explain is such a simple way.
@farhadpagdiwala1789
@farhadpagdiwala1789 2 жыл бұрын
Excellent video Clement. Thoroughly enjoyed watching this for refreshing and jogging my memory on why binary search and trees are so important in Algos and DS.
@irinagr
@irinagr 2 жыл бұрын
Thanks for pointing the importance of logarithms! Awesome, short and spot on explaination!
@frushlife
@frushlife 2 жыл бұрын
Clem thank you so much - I've watched countless videos over the last few days trying to wrap my head around Big O and this was my lightbulb moment - Software dev with 5 odd years professional experience with zero math / algorithms background who has ignored this stuff forever
@Earth-Worm-Tim
@Earth-Worm-Tim Жыл бұрын
Outstanding! I have always found this to be a rather complex topic to really grasp.
@z4ar
@z4ar 2 жыл бұрын
Can't believe I sat through all of this completley focused and invested lol. Starting my compsci study this fall and this was very insightful. Thanks!!
@jaagviveluguleti4271
@jaagviveluguleti4271 2 жыл бұрын
Most valuable video I have received today and exactly what I was looking for....yesterday I watched your How to learn faster video and there you were stating the importance of logarithms...so I was looking for the free video of yours but couldn't find it in your website....now that you've mentioned it.....what a timing!!!! My manifestation always works.
@kayra4080
@kayra4080 2 жыл бұрын
Thank you so much! This made my newly starting informatics journey much more easier, keep up the great work!
@Jared-Cruz
@Jared-Cruz 2 жыл бұрын
You explained this in a way that a non-software engineer or even math savvy person could understand. Fantastic job!
@eloka9015
@eloka9015 Жыл бұрын
i'm literally a law student and i got it!
@maxxpellowski2916
@maxxpellowski2916 2 жыл бұрын
Brilliant explanation, sir. NOW I understand how important they are. Thanks for opening my eyes, yet again.
@AleX_028
@AleX_028 2 жыл бұрын
Sir what an explanation...I never thought logarithms in such perspective and thank you much for that this knowledge I won't forget for my entire life . *Hands down*
@BhupendraSingh-dl5lj
@BhupendraSingh-dl5lj 2 жыл бұрын
The best explanation I have seen on the Internet. Perfect
@mettanotation
@mettanotation Жыл бұрын
Great video 👍🏼. Big-O assumes fundamental operations are the same speed, but it’s useful to know IRL they are different and that can make a huge difference. Famously, John Carmack when developing Quake had to optimize the inverse square root operation as part of the algorithms that made the game playable. I was a game dev before I got my CS degree and it always seemed a little odd detailed optimization wasn’t taught. Oh well theory vs practice I guess.
@sergpodolnii3962
@sergpodolnii3962 2 жыл бұрын
As a person with STEM background I should say that under normal log or ln we usually imply reverse to e^x operation (in electronics engineering convention for log - reverse to 10^x for multitude of dB units). Exponents and ln operations go hand in hand when you deal with calculus more or less on regular basis. And this guy is Log2, what can be a point of confusion.
@Leshpngo
@Leshpngo Жыл бұрын
This was so cool, it felt like I was grabbing the power lines of cs. Thanks Clement this was a amazing video.
@charlesopuoro5295
@charlesopuoro5295 Жыл бұрын
I absolutely found it insightful. Thanks so much for this.
@amixengineer
@amixengineer 2 жыл бұрын
great video, great explanation, I smashed the subscribe button just to look forward seeing these types of videos. well done and thanks Clément.
@thecodingfeast
@thecodingfeast 2 жыл бұрын
It took me 24 years to realise what lag(x) is, thanks to clem!
@sathwicsardana9690
@sathwicsardana9690 2 жыл бұрын
Awesome explanation -- simplified, distilled and de-mystified
@suvammondal7053
@suvammondal7053 2 жыл бұрын
Beautifully explained, loved it.
@Eww...NotTheHumansAgain
@Eww...NotTheHumansAgain Жыл бұрын
A very useful explanation. Thank you!
@somnathpaul3004
@somnathpaul3004 2 жыл бұрын
Superb explanation. It was never that much easy to me before this video.
@KaleemKhan-dr4vi
@KaleemKhan-dr4vi Жыл бұрын
This is the most amazing explanation I have seen.
@MagedMegz95
@MagedMegz95 2 жыл бұрын
Amazing. Just amazingly and simply explained. Thanks.
@KrishnaKaliyuga
@KrishnaKaliyuga Жыл бұрын
Awesome Explanation Thank You
@heyheyhey0220
@heyheyhey0220 2 жыл бұрын
In algorithms we say O(log(n)) because all log bases are the same O set. They differ only by a constant coefficient and therefore are the same O.
@mreagantn
@mreagantn Жыл бұрын
Great explanation. Thank you!
@godsdarkestangel4519
@godsdarkestangel4519 2 жыл бұрын
Informative. Thanks Clément.
@malanbandara
@malanbandara 2 жыл бұрын
Wow Clement you're really good at teaching. Thank you
@brandonblackwell1216
@brandonblackwell1216 Жыл бұрын
Best explanation I have ever heard. You are one of a kind sir.
@siphokazimanana7677
@siphokazimanana7677 2 жыл бұрын
Well done!!!! Very thoughtful way to explain it
@sp3ctrums264
@sp3ctrums264 2 жыл бұрын
Thank you! Explanation was so helpful
@AccessCode101
@AccessCode101 2 жыл бұрын
Wow man, you should do more videos about math. I know that's your major but imagine how many people are looking to learn algebra and linear algebra or whatever type of algebra that can help them better understand algorithms.
@olga8687
@olga8687 Жыл бұрын
The best explanation of logarithm I've ever heard.
@pratyushsrivastava4476
@pratyushsrivastava4476 2 жыл бұрын
My college didn't prepare me for Time Complexity so I just ran over DSA like it was a normal subject. This really opened my eyes, Time to Learn again
@seandougan8593
@seandougan8593 Ай бұрын
This was good, very to the point on why they are important
@rachanasingh9476
@rachanasingh9476 2 жыл бұрын
awesome video @Clément Mihailescu
@ursawarior4ever
@ursawarior4ever 2 жыл бұрын
algorithms aside, i can tell youve been working out. Good stuff man.
@vishaldhavale5234
@vishaldhavale5234 Жыл бұрын
Really great explanation..Thanks
@lethatsinkin
@lethatsinkin Жыл бұрын
This was super helpful!
@BJTangerine
@BJTangerine 2 жыл бұрын
Very nicely explained, even a layman like me was engaged with your content
@alambez
@alambez 2 жыл бұрын
Thanks for the insights.
@kjanshair
@kjanshair 2 жыл бұрын
Brilliant Explanation.
@mariadmt8569
@mariadmt8569 2 жыл бұрын
Mulțumesc pentru explicații!
@tttmsu
@tttmsu 2 жыл бұрын
Super helpful, thank you
@temiyeakinyemi6236
@temiyeakinyemi6236 2 жыл бұрын
I completely understood this video because I just started learning what Big O notation is... Now I can see why O(log n) is better than O(n).
@wian7284
@wian7284 2 жыл бұрын
Hey Clement, great stuff with something like this :) also on a slightly different note I felt some energy shift in your overall personality outlook from the video..kinda like did you changed a bit in anyway or with something that's going on lately? :p
@EwertonSilveiraAuckland
@EwertonSilveiraAuckland Жыл бұрын
Tks for the explanation 🎊
@Nikolai41Volkoff
@Nikolai41Volkoff 2 жыл бұрын
dude, you're the man. thank you.
@kell7689
@kell7689 2 жыл бұрын
Great explanation!
@vigneshravichandran2965
@vigneshravichandran2965 2 жыл бұрын
great explanation , now I have realized how the time coplexity is O(log n )
@mauroquinteros8783
@mauroquinteros8783 2 жыл бұрын
More visual would be excellent, thanks Clement!
@quantumleap9520
@quantumleap9520 2 жыл бұрын
Great Explanation
@danielcardona5268
@danielcardona5268 2 жыл бұрын
Nice video, to me thinking of logarithm is more intuitive if you think of it as the operation that tells you how many times you can successively divide by the base, instead of thing of it as a inverted power. Essentially “how many times can I chop in half“
@aperture0
@aperture0 2 жыл бұрын
Nice. I just learnt it using 7 rule.
@T-The-K
@T-The-K 8 ай бұрын
This helped ty!
@list9016
@list9016 2 жыл бұрын
wow- i had no idea i was missing out on something this opowerful
@TutorialTechie
@TutorialTechie Ай бұрын
I understand every bit he siad great explanation.
@luiscesar5450
@luiscesar5450 2 жыл бұрын
This was good. Thanks
@kevinz1991
@kevinz1991 2 жыл бұрын
Such an awesome video thank you 🙂
@marvet9573
@marvet9573 2 жыл бұрын
Glad I subbed, logarithms actually mean something now other than a pain in the ass on my math exams lol
@1991hemanth
@1991hemanth 2 жыл бұрын
Amazing explanation. 🔥🔥🔥
@srivishnu8983
@srivishnu8983 Жыл бұрын
interestingly explained !!
@codecontent9717
@codecontent9717 2 жыл бұрын
Hey man, please release a course or playlist for colleg dropout trying to learn computer science. One important thing is in what order to learn what and what to learn in parallel. Please consider maths too in it. It would help a lot of souls. Thanks and amazing work. Appreciate it, really.
@Vino359
@Vino359 2 жыл бұрын
Thanks Clement
@ramseykarr6870
@ramseykarr6870 2 жыл бұрын
Wonderful explanation 🙂
@danielkakai2877
@danielkakai2877 Жыл бұрын
Great explanation
@sameerplaynicals8790
@sameerplaynicals8790 Жыл бұрын
great explanation of log
@Jonathan-kx2be
@Jonathan-kx2be Жыл бұрын
great video helped a lot
@Djangoo-uy1nl
@Djangoo-uy1nl 2 жыл бұрын
Damn it Mr. Jeffreys this is how you explain stuff to students! Great explanation
@thecashewtrader3328
@thecashewtrader3328 2 жыл бұрын
yes
@billykotsos4642
@billykotsos4642 2 жыл бұрын
Thanks, really helpful
@jibin7277
@jibin7277 2 жыл бұрын
very useful man !
@fatimalmasri7715
@fatimalmasri7715 Жыл бұрын
Omg i cant believe it u explain math in the best way ever i swear ure awesome
@ranjitbisai9335
@ranjitbisai9335 11 ай бұрын
very good explanation
@anshukmishra4520
@anshukmishra4520 2 жыл бұрын
Very Helpful video
@kyeiiih4422
@kyeiiih4422 2 жыл бұрын
Just a dope explanation
@criptik5208
@criptik5208 2 жыл бұрын
How do you study after tuning light off, domt you form algos in pen and paper
@konstantindevelops131
@konstantindevelops131 2 жыл бұрын
Understood better than from reading your LinkedIn Post hah Cheers for that!
@asyrafsyahla7868
@asyrafsyahla7868 2 жыл бұрын
very useful video to Understand
@techienomadiso8970
@techienomadiso8970 2 жыл бұрын
Wow such an interesting realization you've made me have today 💪😃. I never thought of the log this way. Now that means if our algorithm divides the list into k groups say 3 groups...we could use log to base k which is 3 in this case. 🤦🔥🔥🔥💯💯💯 This is amazing
@eric000
@eric000 2 жыл бұрын
In the real computing world for simplicity O(log n) can be thought of as O(1) when weighted against O(n) and O(nlogn) as O(n) when compared to O(n^2) algorithms etc right? to make things simpler right? for worst case big O scenarios.
@lincolnkroll
@lincolnkroll 2 жыл бұрын
Thank you!
@bhargavpandya9189
@bhargavpandya9189 2 жыл бұрын
Do more technical videos like these please
@Dr_Doofenshmirts
@Dr_Doofenshmirts 2 жыл бұрын
Question, is it possible to make an ad blocker from scratch?
@rhen4610
@rhen4610 2 жыл бұрын
I will come back to this few years later after I graduate on my Computer Science college. Philippine College is real slow and basic compare to high standards college like in the US
@pablon3115
@pablon3115 Жыл бұрын
I'm not sure if logarithmic time complexity requires to operarate in parallel (with concurrency or multithreading) to make sense. In case of adding the numbers of an array of eight elements, in a logarithmic time complexity, once the array is split in three levels, then it will perform each sum in parallel. For instance, for the first operation, at the same time it will perform: 1+2=3; 3+4=7; 5+6=11; 7+8=15. Then for the second operation, also at the same time: 3+7=10; 11+15=26. And for the third operation, also at the same time 10+26=36. Am I right?
@mishadaro9759
@mishadaro9759 2 жыл бұрын
at last, I understand. Some articles complicate this so much...
@Why_I_am_a_theist
@Why_I_am_a_theist 2 жыл бұрын
New ad of SystemExpert
@alex-ie7pt
@alex-ie7pt 2 жыл бұрын
Can you do a video on Group Theory?
@nikenuke
@nikenuke Жыл бұрын
Thanks!
@TonyBrackins-kt6ie
@TonyBrackins-kt6ie 5 ай бұрын
Wow. Really good.
@anshukmishra4520
@anshukmishra4520 2 жыл бұрын
KZbin should promote this kind of video
@_Anna_Nass_
@_Anna_Nass_ Жыл бұрын
Unrelated but you have some fantastic bone structure, dude.
@oltialex
@oltialex 2 жыл бұрын
"When a measure becomes a target, it ceases to be a good measure." Do you think this fits to the fact that big companies ask for algorithm problems and we blindly try to prepare for them?
@FahmiEshaq
@FahmiEshaq 2 жыл бұрын
man! excellent content
@tomeyan3544
@tomeyan3544 Жыл бұрын
thank u so much
What To Do If You're Stuck In A Coding Interview
9:48
Clément Mihailescu
Рет қаралды 170 М.
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 4 МЛН
КАКОЙ ВАШ ЛЮБИМЫЙ ЦВЕТ?😍 #game #shorts
00:17
Poopigirl
Рет қаралды 10 МЛН
I Built a Shelter House For myself and Сat🐱📦🏠
00:35
TooTool
Рет қаралды 24 МЛН
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 31 МЛН
Do You Need To Learn Data Structures & Algorithms As A Developer?
13:12
4 Common Mistakes In Coding Interviews
10:16
Clément Mihailescu
Рет қаралды 113 М.
Learn Big O notation in 6 minutes 📈
6:25
Bro Code
Рет қаралды 200 М.
Logarithms: why do they even exist?
12:47
Ciaran McEvoy
Рет қаралды 83 М.
Why algorithms are called algorithms | BBC Ideas
3:09
BBC Ideas
Рет қаралды 2,7 МЛН
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 1,7 МЛН
Big O Notation Series #5: O (n log n) explained for beginners
5:20
Kantan Coding
Рет қаралды 92 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 24 МЛН
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 612 М.
#miniphone
0:16
Miniphone
Рет қаралды 918 М.
ЭТОТ ЗАБЫТЫЙ ФЛАГМАН СИЛЬНО ПОДЕШЕВЕЛ! Стоит купить...
12:54
Thebox - о технике и гаджетах
Рет қаралды 151 М.