Тёмный

Big-O Notation - For Coding Interviews 

NeetCode
Подписаться 738 тыс.
Просмотров 415 тыс.
50% 1

🚀 neetcode.io/ - Get lifetime access to all current & future courses I create!
Going over all of the common big O time and space complexities, with a focus on coding interviews.
Checkout my second Channel: @NeetCodeIO
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
Code from the video: neetcode.io/courses/lessons/b...
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
0:00 - Intro
0:43 - What is Big-O
1:48 - O(1)
2:55 - O(n)
6:35 - O(n^2)
9:30 - O(n * m)
10:02 - O(n^3)
10:45 - O(logn)
13:18 - O(nlogn)
14:58 - O(2^n)
17:30 - O(sqrt(n))
18:26 - O(n!)
19:26 - Conclusion
#coding #neetcode #python

Наука

Опубликовано:

 

24 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 242   
@NeetCode
@NeetCode Год назад
🚀 neetcode.io/ - Get lifetime access to all current & future courses I create! Code from the video: neetcode.io/courses/lessons/big-o-notation
@shubhamboghara4490
@shubhamboghara4490 Год назад
Please unban me on discord server.
@abijithgs3132
@abijithgs3132 Год назад
Please do teach us the math side of these
@emonymph6911
@emonymph6911 Год назад
Can you please make an advanced algorithm evaluation course I know there are multiple ways to measure algorithms some are good for read/writes others for CPU etc. Can you educate us on what type of algorithmic performance would lower cloud bills haha, stick it to the big 3! I believe they ways to measure are called algorithmic efficiencies: time efficiency, space efficiency, complexity theory, functional dominance, asymptotic dominance. Found a site before that compared algorithms that way but forgot the name! :(
@akshaymalhotra2550
@akshaymalhotra2550 Год назад
NEET coupon is expired it's showing. In India it's very expensive 130 USD it comes around 10,000 INR
@NeetCode
@NeetCode Год назад
@@akshaymalhotra2550 feel free to email me at neetcodebusiness@gmail
@zeeg1529
@zeeg1529 10 месяцев назад
60% through the video but just can't hold in the comment any longer. this is by far the best big-O notation explanation I've ever encountered in my life. I have bachelor in computer science and master in AI systems, and have solved a bit more than 300 leetcode problems, aside from almost 8 years of software engineer production experience, yet nobody was able to explain this better to me than you did. an absolutely amazing visualisation! before this video I knew the most of basic notations (O(n), O(n^2) etc), yet I was still struggling with logarythmic ones. HUUUUUGE thank you for this. It's almost unbelievable the content of this quality is out here on youtube for free!
@sergio_henrique
@sergio_henrique 5 месяцев назад
​@@Corvurax1In accordance with the sagacious principles elucidated by the eminent philosopher of modern digital discourse, the revered YouTubian's Third Law of Virtual Dynamics declares that within the realm of virtual discourse, for each "wholesome comment" that emanates from the depths of digital appreciation, a commensurate and opposing "vitriolic comment" shall arise, thus maintaining a harmonious equilibrium within the intricate tapestry of online interactions.
@sonyaviolet9501
@sonyaviolet9501 4 месяца назад
As a holder of the master's degree in applied mathematics and software engineer for 25+ years I'd agree with that.
@karlaronquillo1873
@karlaronquillo1873 3 месяца назад
@@sergio_henrique damn your writing skills are fireee
@badiazaki3059
@badiazaki3059 Месяц назад
You got your big O ?
@daen3206
@daen3206 Год назад
next video suggestion: 1. time complexities of graph traversals BFS/DFS in terms of V & E 2. time complexities of advanced graph algo like djikstra, bellman ford, prim, kruskal MST, topo sort 3. time complexities of backtracking algos in the backtracking section
@MrTyty527
@MrTyty527 Год назад
also algorithms with complexity related to height of tree
@extrempty
@extrempty Год назад
floyd warshall too
@mojojojo1211
@mojojojo1211 11 месяцев назад
yess! please!
@AromonChannel
@AromonChannel 10 месяцев назад
thanks stan!
@frosty_teacup
@frosty_teacup Год назад
I've been struggling with this A LOT, so you couldn't have chosen a better time to make this video. Thank you for single-handedly getting us all through the grind!
@jayjay4027
@jayjay4027 6 месяцев назад
For people who still get confused, imagine you have an array with length of 8, after 1 step, the size is 4, step 2 size is 2, step 3 size is 1. So 2^3= 8, another way of saying is, it takes 3 steps to get to 1. So 2^3=8 means log2(8)=3. Which means if you have an array of n elements, then 2^x =n, where x is the steps to take, so log2(n) = x
@Caggen218
@Caggen218 Год назад
Been having some issues wrapping my head around parts of big-O, and this was precisely the explanation I needed for the last bits to snap into place! Cheers!
@agbeliemmanuel6023
@agbeliemmanuel6023 Год назад
Man, you are a genius. I love the way you explain your stuff. Much love!!!
@indianengineer5802
@indianengineer5802 Год назад
Thanks for being active on YT for the ones wo can't afford your course 🙂
@terrypark3690
@terrypark3690 Год назад
I've seen a ton of algorithm lectures and your videoes are the only ones that have finally gotten through to me thank you for making them!
@polardyth8300
@polardyth8300 Год назад
Idiot
@jspanchal
@jspanchal Год назад
Possibly the simplest way of explaining Big-O notations. Kudos.
@joker345172
@joker345172 3 месяца назад
The level of quality in this video is off the charts! I have a bachelors in computer science and got my masters from a Tier 1 university, and although I've passed my classes in algorithm complexity, NONE of my professors had the tact and the ability to present this subject like you did in this video. Absolutely phenomenal job, with this video you're democratizing access to information and teaching this crucial subject to so many different people. Absolutely stellar job!
@yizhou2675
@yizhou2675 11 месяцев назад
Love the way you explain things, so clear and creative and EASY to understand!!
@carlossouza5151
@carlossouza5151 Год назад
This is the best explanation on RU-vid about the topic, congrats
@terrellestephens7088
@terrellestephens7088 Год назад
First video I've ever watched from this channel. Subscribed. Extremely well explained.
@user-fk1wo2ys3b
@user-fk1wo2ys3b Год назад
THANKS FOR GREAT EXPLANATIONS! I have become a sponsor of the channel now.
@NihongoWakannai
@NihongoWakannai Год назад
20:04 I think it's important to note that big O notation does not measure the efficiency of an algorithm, it only measures the CHANGE in performance as the data set increases in size. The invisible constants in big O are VERY important when working on actual real world applications. Oftentimes increased performance comes from reducing the cost of performing individual iterations, which doesn't change the big O at all.
@kevin.malone
@kevin.malone Год назад
Yup this is super important to note, because a lot of times big O is explained as a perform tuning metric. But really it’s about scalability. Scalability is just one aspect of performance tuning. Most of the performance bottlenecks I run into in real world scenarios have more to do with simply not archiving old data or not throwing away bad data. It’s much more common to see a memory or IOPS bottleneck than a cpu bottleneck at the jobs I’ve worked.
@SimpleNot1759
@SimpleNot1759 Год назад
There's also much data that however-bad-at-big-O code actually may work fine and efficient at proper low scale while the big-O-good-enough code at that scale would suck.
@markganus1085
@markganus1085 10 месяцев назад
simple and to the point. worth checking over and over
@lorenainfanter.3099
@lorenainfanter.3099 3 месяца назад
This is the best explanatory video I've seen about Big-O notation. You make it friendly to understand. Thank you very much!
@amospan14
@amospan14 Год назад
Really, really appreciate you explaining this topic in detail! This was amazing!
@codealonewithGod
@codealonewithGod Год назад
Took me a long time to comprehend this but I’m finally certain I completely understand how this works
@KareemAshraf91
@KareemAshraf91 2 месяца назад
Man! This is the best big-O explanation video on the internet 🙏🏻 thanks so much for your effort! 👏🏼👏🏼
@manojamrutharaj9071
@manojamrutharaj9071 Год назад
Probably the best flash card video on Big-O... Thanks NC
@olgashevchenko8439
@olgashevchenko8439 8 месяцев назад
The best explanation I could find on RU-vid, thanks❤
@hardikvora3744
@hardikvora3744 Год назад
What a great video! Thanks for keeping it free!
@Shaddymaze
@Shaddymaze Год назад
So well explained! Keep up the great vids!
@Brosales1414
@Brosales1414 Год назад
Oh Man Thank you Neetcode! I've been struggling with this!
@shawngeorge7486
@shawngeorge7486 8 месяцев назад
well explained my fried, you summarised two weeks worth of lectures in 20 minutes thanks for this
@youssrachagri5294
@youssrachagri5294 4 месяца назад
friend*
@imnischaygowda
@imnischaygowda Год назад
Thank you for this video, really needed an undersanding of TIme Complexitites, this videos fills that gap. Peace.
@VidyaBhandary
@VidyaBhandary Год назад
Awesome .... Was just thinking it would be good if there was a Neetcode video on this.. and here it is... Like a wish come true. .... !!!!! Thank you so very much .....
@cristiantapia631
@cristiantapia631 Год назад
Neet you're doing gods work! thank you!
@nawalkhawar7602
@nawalkhawar7602 9 месяцев назад
I have a quiz in an hour and this helped SO much?? Thank you!
@shaunaksen9676
@shaunaksen9676 8 месяцев назад
best BigO notation explanation period.
@bubblebath2892
@bubblebath2892 2 месяца назад
I feel blessed that you are on youtube and I found you as a teacher
@khalilromdhani6415
@khalilromdhani6415 11 месяцев назад
I was diving through out a lot of video and I just get it here really awesome explanation
@nischayagrawalVlogs
@nischayagrawalVlogs 9 месяцев назад
Bruh how do you explain things so well? Like seriously...not everyone who knows dsa has the potential to lay things out so easily. Your explanation has helped me a lot in many problems. Thanks a bunch man. Thanks a bunch.
@ZeEduardo95
@ZeEduardo95 4 месяца назад
I would say that he actually has a deep understand of this. Like Feynmann put it, when you actually know something you can explain it to a 5 year old.
@marcusgarner1146
@marcusgarner1146 Год назад
Thank you for a great explanation of Big-O, very helpful!
@moestaxx286
@moestaxx286 Год назад
im not going to lie neetcode this is the hardest thing i ever had to learn in my life, but I will continue trying to get better at this algorithms stuff. thank you for putting out content to continue to help me out.
@quinnherden
@quinnherden 10 месяцев назад
How's it going, Moe?
@Jonathan-rm6kt
@Jonathan-rm6kt 4 месяца назад
9:08 your simple, intuitive explanation on the proof of recursive loop is amazing. I took combinatorics classes in college where it took a professor 40 minutes to convey the similar intuition. To everyone out there feeling Fomo on college-- don't.
@dswalkij3201
@dswalkij3201 6 месяцев назад
Thank you. I need it for my final exam. Very clear explanation and examples.
@someguynamedvictor
@someguynamedvictor 2 месяца назад
This was great! I'm a more hands-on programmer with less hard CS knowledge and more in-the-trenches but you made it make sense. Thank you so much, trying to prep for this Meta interview and this is gold.
@TheStrafendestroy
@TheStrafendestroy Год назад
thank god i have been waiting for this video!!!!
@user-vt2ml9ot6e
@user-vt2ml9ot6e Месяц назад
Wonderful explanation. I have bachelor degree of IT and only now have I understood what big notation is all about. Thank you
@commanderlabelle1
@commanderlabelle1 Месяц назад
I also haven't even gotten to the end of the video yet. But wow, this is so great! Thank you! You have my sub and my thumbs up for sure :)
@rakeshbalavanthapu
@rakeshbalavanthapu Год назад
I have been following your channel for quite sometime now. You are the best teacher on you tube as far as I know. You have a gift. Thanks for all that you do to help others. Quick question: what tool do you use to draw pictures in your explanations?
@obehiehimen1198
@obehiehimen1198 Год назад
This is just what I needed!
@bloodtalon27
@bloodtalon27 5 месяцев назад
studying this as a devops engineer who has never had to do anything related to this in my job, but has an interview with Amazon. Thanks Amazon!
@princeplayz8374
@princeplayz8374 3 месяца назад
your teaching is phenomenal
@ramielsayed2614
@ramielsayed2614 Год назад
We love neetcode! We love neetcode!
@jerkmeo
@jerkmeo 7 месяцев назад
awesome video with concrete example. Well done.
@dalenjournigan6957
@dalenjournigan6957 Месяц назад
Thanks, using this to help me study for an exam!
@4n3c3d
@4n3c3d Год назад
thank you so much for this, you're the best!
@UdayGarg1998
@UdayGarg1998 Год назад
Awesome video man! Space complexity next?
@mr.rodzhers8663
@mr.rodzhers8663 7 месяцев назад
Thank you for a great explanation, very helpful!
@iggykarpov
@iggykarpov 5 месяцев назад
Time stamps in description very helpful - thanks! 1:48 - O(1) 2:55 - O(n) 6:35 - O(n^2) 9:30 - O(n * m) 10:02 - O(n^3) 10:45 - O(logn) 13:18 - O(nlogn) 14:58 - O(2^n) 17:30 - O(sqrt(n)) 18:26 - O(n!) 19:26 - Conclusion
@rajad6780
@rajad6780 Год назад
Simply brilliant!! Thank you for amazing content. Super helpful 🙌
@ramireddyvarun26
@ramireddyvarun26 3 месяца назад
log n finally makes sense! thanks neetcode!
@stxllr4687
@stxllr4687 Год назад
11:40 im stupid asf in math, but you explained that so clearly my teachers would be jealous. i swear you’re just talented in teaching
@Corvurax1
@Corvurax1 5 месяцев назад
This video did not talk about the mathematical understanding behind time complexity, which is something you learn in computer science.
@dhedarkhcustard
@dhedarkhcustard 4 месяца назад
I finally know what big O is. Thank you.
@Juicybet
@Juicybet 6 месяцев назад
Hi! Thanks for the video :) will keep an eye out for updates
@gustavo9758
@gustavo9758 Год назад
8:40 excellent way of explaining it!
@alekseishkurin4590
@alekseishkurin4590 10 месяцев назад
Definitely interested in the "math stuff"!
@AbyteofAlex
@AbyteofAlex 5 месяцев назад
Thanks, amazing video!
@AnnieBox
@AnnieBox Год назад
great video!!👍🏻
@alihezarpisheh8350
@alihezarpisheh8350 Месяц назад
Great Video! Thanks ❤
@makyxyz3375
@makyxyz3375 11 месяцев назад
Hi NeetCode! Super video, thank you! I have a question: it's importanto for faang interview to have in your skills the analysis of the recurrence relation to retrive big o complexity in recursive functions? Thank you
@mosley4442
@mosley4442 Год назад
liked and subscribed bc of my amazing instructor Big Jonathan.
@alekjatuszyk4976
@alekjatuszyk4976 Год назад
damn this is a really good video. 20 min, and i understand it :)
@omother942
@omother942 Год назад
You are a legend.
@fredteixeira3604
@fredteixeira3604 Год назад
Sqrt time is used with prime and composite numbers calculations. It might be used in cryptography
@tejasbachhav3921
@tejasbachhav3921 9 месяцев назад
thanks for the explanation!
@its_me_tabs
@its_me_tabs 8 месяцев назад
This guy is GOATed!
@jaredr.6572
@jaredr.6572 Год назад
thank you for this!!
@vishalptwpatwa4512
@vishalptwpatwa4512 11 месяцев назад
Hey Neet, Can you check the time stamp 10:35 ? For the code to be cubic don’t the j and k variables have to start loop from 0 till the len(nums) ?
@md.sharifulhaque2717
@md.sharifulhaque2717 Месяц назад
Thanks for the nice explanation. Probably the best out there for free. Just wanted to make sure one thing. At 14:45 when you run heapify and heapop separately the time complexity of the overall function should be n+logn, not n+nlogn and hence O(n) a the end.
@motaphe5732
@motaphe5732 Месяц назад
But since we are doing it in a while loop, it is n+nlog(n). heappop takes log(n) and since we need to perform that for every element in the heap, it becomes nlog(n)
@asimarunava
@asimarunava Год назад
Man i have been trying to make this chart in my mind for several years. Finally your video saved me. God bless you 🎉
@beccyenroute7896
@beccyenroute7896 5 месяцев назад
great explanation!!
@hokben2go
@hokben2go 3 месяца назад
Great job sir!
@devidasgaikwad8430
@devidasgaikwad8430 9 месяцев назад
You are just Awesome!!!!
@SanjayB-vy4gx
@SanjayB-vy4gx Год назад
can you pls do maths concepts needed for progrmmers this wiil be really helpfull for many students your explanation is easy to understand
@Misteribel
@Misteribel 7 месяцев назад
2:20 all the examples for O(1) are wrong, except array index lookup. An array that you can append to is usually a linked list, not an array. A hashmap, dictionary, map etc searches by indexed hashes. Both insert and lookup are amortized O(1), but worst case O(n) or O(log(n)), depending on language. Then, it still matters whether you use immutable or concurrent hash maps, which have a different complexity. I don't know if they ask this in interviews, but it's not as simple as shown here, there are many subtleties involved.
@mujtabarehman5255
@mujtabarehman5255 7 месяцев назад
Deleting from the end of an array should also be constant time. But you're right, nothing is simple.
@AlejandroMallea
@AlejandroMallea 7 месяцев назад
This might come from the misconception that big O means average case, ignoring its formal definition. He also says most sorting implementations are nlog(n), which again is average case but not big O. Even merge sort, which is actually O(nlog(n)) in *time* complexity, is slower in practice than something like in-place quicksort because of its huge penalty by using linear memory, which is something completely missed here. Same for appending to an array, which is fast until it requires reallocation when it grows beyond its current capacity. Unfortunately though, I suspect many interviewers just want to hear the simplest version possible, like nlog(n) for sorting and O(1) for hash map insertion, which you can do by memorizing these formulas but doesn't imply an understanding of the concept.
@abhaytiwari5991
@abhaytiwari5991 Год назад
Thanks dude 😎
@weiyaoli6977
@weiyaoli6977 Год назад
just fantastic
@DD-bw1xb
@DD-bw1xb Год назад
Thanks!
@harishsn4866
@harishsn4866 Год назад
Please upload a video for String Compression 2. Leetcode 1531. It would be really helpful.
@myrtiy
@myrtiy Год назад
This semester I am getting two internships because of you. God bless you!
@illiachalyk195
@illiachalyk195 2 месяца назад
So sad that RU-vid does not allow you to leave more than one like. Amazing video!
@yuliiakovalova1437
@yuliiakovalova1437 Год назад
Thank you!!!
@drbinxy9433
@drbinxy9433 6 месяцев назад
When he said “if you’re not smart enough” I felt that
@iezioaudi22
@iezioaudi22 4 месяца назад
thank you!
@austintownsend1660
@austintownsend1660 Год назад
We love you ❤️
@piglovesasy
@piglovesasy 23 дня назад
could you explain/do a video on 2^n vs log2 (n), thanks
@kvelez
@kvelez 7 месяцев назад
Great video.
@beastdunk23
@beastdunk23 3 месяца назад
dude keep it up
@tanoybhowmick8715
@tanoybhowmick8715 Год назад
Great content
@Cruzylife
@Cruzylife Год назад
this is awesome
@Politics4Fun
@Politics4Fun 2 месяца назад
Awesome ✨
@utkarshdewan8736
@utkarshdewan8736 Год назад
Best python DSA youtuber out their. It's a shame more people don't cover ds algo using python.
@sagardash1805
@sagardash1805 Год назад
Neet explanation ❤❤
@shirish2005
@shirish2005 Год назад
best explanation
@mohammedabdallah7148
@mohammedabdallah7148 Год назад
Hey! Can you please solve Leetcode 547. Number of Provinces? Its one of Amazons most frequently asked questions. Would mean alot
Далее
I quit Amazon after two months
10:09
Просмотров 572 тыс.
Mock Google Coding Interview with a Meta Intern
47:04
Просмотров 909 тыс.
Two Sum | LeetCode 1 | JavaScript | Easy
13:20
Просмотров 6 тыс.
How I would learn Leetcode if I could start over
18:03
Просмотров 257 тыс.
Top 7 Data Structures for Interviews Explained SIMPLY
13:02
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
XAVFSIZLIK UCHUN KAMERA. Hikvision
38:51
Просмотров 18 тыс.
Все розовые iPhone 💕
0:51
Просмотров 206 тыс.