Big-O Notation - For Coding Interviews

  Рет қаралды 398,246

NeetCode

NeetCode

Күн бұрын

🚀 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

Пікірлер: 239
@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 9 ай бұрын
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 4 ай бұрын
​@@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 2 ай бұрын
@@sergio_henrique damn your writing skills are fireee
@badiazaki3059
@badiazaki3059 13 күн бұрын
You got your big O ?
@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
@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 11 ай бұрын
floyd warshall too
@mojojojo1211
@mojojojo1211 10 ай бұрын
yess! please!
@AromonChannel
@AromonChannel 9 ай бұрын
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!
@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!
@joker345172
@joker345172 2 ай бұрын
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!
@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 🙂
@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.
@jspanchal
@jspanchal Жыл бұрын
Possibly the simplest way of explaining Big-O notations. Kudos.
@yizhou2675
@yizhou2675 10 ай бұрын
Love the way you explain things, so clear and creative and EASY to understand!!
@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
@carlossouza5151
@carlossouza5151 Жыл бұрын
This is the best explanation on KZfaq about the topic, congrats
@terrellestephens7088
@terrellestephens7088 Жыл бұрын
First video I've ever watched from this channel. Subscribed. Extremely well explained.
@lorenainfanter.3099
@lorenainfanter.3099 2 ай бұрын
This is the best explanatory video I've seen about Big-O notation. You make it friendly to understand. Thank you very much!
@markganus1085
@markganus1085 10 ай бұрын
simple and to the point. worth checking over and over
@KareemAshraf91
@KareemAshraf91 Ай бұрын
Man! This is the best big-O explanation video on the internet 🙏🏻 thanks so much for your effort! 👏🏼👏🏼
@bloodtalon27
@bloodtalon27 4 ай бұрын
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!
@iggykarpov
@iggykarpov 4 ай бұрын
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
@amospan14
@amospan14 Жыл бұрын
Really, really appreciate you explaining this topic in detail! This was amazing!
@olgashevchenko8439
@olgashevchenko8439 7 ай бұрын
The best explanation I could find on KZfaq, thanks❤
@codealonewithGod
@codealonewithGod Жыл бұрын
Took me a long time to comprehend this but I’m finally certain I completely understand how this works
@Shaddymaze
@Shaddymaze Жыл бұрын
So well explained! Keep up the great vids!
@user-vt2ml9ot6e
@user-vt2ml9ot6e 23 күн бұрын
Wonderful explanation. I have bachelor degree of IT and only now have I understood what big notation is all about. Thank you
@user-fk1wo2ys3b
@user-fk1wo2ys3b Жыл бұрын
THANKS FOR GREAT EXPLANATIONS! I have become a sponsor of the channel now.
@Jonathan-rm6kt
@Jonathan-rm6kt 3 ай бұрын
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.
@someguynamedvictor
@someguynamedvictor Ай бұрын
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.
@princeplayz8374
@princeplayz8374 2 ай бұрын
your teaching is phenomenal
@khalilromdhani6415
@khalilromdhani6415 11 ай бұрын
I was diving through out a lot of video and I just get it here really awesome explanation
@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!
@bubblebath2892
@bubblebath2892 Ай бұрын
I feel blessed that you are on youtube and I found you as a teacher
@dswalkij3201
@dswalkij3201 5 ай бұрын
Thank you. I need it for my final exam. Very clear explanation and examples.
@hardikvora3744
@hardikvora3744 Жыл бұрын
What a great video! Thanks for keeping it free!
@Brosales1414
@Brosales1414 Жыл бұрын
Oh Man Thank you Neetcode! I've been struggling with this!
@manojamrutharaj9071
@manojamrutharaj9071 Жыл бұрын
Probably the best flash card video on Big-O... Thanks NC
@shaunaksen9676
@shaunaksen9676 8 ай бұрын
best BigO notation explanation period.
@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 .....
@dalenjournigan6957
@dalenjournigan6957 25 күн бұрын
Thanks, using this to help me study for an exam!
@imnischaygowda
@imnischaygowda Жыл бұрын
Thank you for this video, really needed an undersanding of TIme Complexitites, this videos fills that gap. Peace.
@mr.rodzhers8663
@mr.rodzhers8663 6 ай бұрын
Thank you for a great explanation, very helpful!
@nischayagrawal8373
@nischayagrawal8373 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 3 ай бұрын
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.
@jerkmeo
@jerkmeo 6 ай бұрын
awesome video with concrete example. Well done.
@gustavo9758
@gustavo9758 11 ай бұрын
8:40 excellent way of explaining it!
@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?
@commanderlabelle1
@commanderlabelle1 9 күн бұрын
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 :)
@TheStrafendestroy
@TheStrafendestroy Жыл бұрын
thank god i have been waiting for this video!!!!
@rajad6780
@rajad6780 Жыл бұрын
Simply brilliant!! Thank you for amazing content. Super helpful 🙌
@shawngeorge7486
@shawngeorge7486 7 ай бұрын
well explained my fried, you summarised two weeks worth of lectures in 20 minutes thanks for this
@youssrachagri5294
@youssrachagri5294 4 ай бұрын
friend*
@marcusgarner1146
@marcusgarner1146 Жыл бұрын
Thank you for a great explanation of Big-O, very helpful!
@obehiehimen1198
@obehiehimen1198 Жыл бұрын
This is just what I needed!
@alihezarpisheh8350
@alihezarpisheh8350 Ай бұрын
Great Video! Thanks ❤
@ramielsayed2614
@ramielsayed2614 Жыл бұрын
We love neetcode! We love neetcode!
@ramireddyvarun26
@ramireddyvarun26 2 ай бұрын
log n finally makes sense! thanks neetcode!
@hokben2go
@hokben2go 2 ай бұрын
Great job sir!
@AbyteofAlex
@AbyteofAlex 4 ай бұрын
Thanks, amazing video!
@4n3c3d
@4n3c3d Жыл бұрын
thank you so much for this, you're the best!
@UdayGarg1998
@UdayGarg1998 Жыл бұрын
Awesome video man! Space complexity next?
@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 9 ай бұрын
How's it going, Moe?
@dhedarkhcustard
@dhedarkhcustard 3 ай бұрын
I finally know what big O is. Thank you.
@Juicybet
@Juicybet 5 ай бұрын
Hi! Thanks for the video :) will keep an eye out for updates
@beccyenroute7896
@beccyenroute7896 4 ай бұрын
great explanation!!
@md.sharifulhaque2717
@md.sharifulhaque2717 22 күн бұрын
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 12 күн бұрын
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)
@tejasbachhav3921
@tejasbachhav3921 9 ай бұрын
thanks for the explanation!
@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) ?
@alekseishkurin4590
@alekseishkurin4590 9 ай бұрын
Definitely interested in the "math stuff"!
@AnnieBox
@AnnieBox Жыл бұрын
great video!!👍🏻
@drbinxy9433
@drbinxy9433 5 ай бұрын
When he said “if you’re not smart enough” I felt that
@its_me_tabs
@its_me_tabs 7 ай бұрын
This guy is GOATed!
@omother942
@omother942 Жыл бұрын
You are a legend.
@kvelez
@kvelez 6 ай бұрын
Great video.
@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 4 ай бұрын
This video did not talk about the mathematical understanding behind time complexity, which is something you learn in computer science.
@jaredr.6572
@jaredr.6572 Жыл бұрын
thank you for this!!
@devidasgaikwad8430
@devidasgaikwad8430 8 ай бұрын
You are just Awesome!!!!
@austintownsend1660
@austintownsend1660 11 ай бұрын
We love you ❤️
@GregThatcher
@GregThatcher 21 күн бұрын
Thanks!
@mosley4442
@mosley4442 Жыл бұрын
liked and subscribed bc of my amazing instructor Big Jonathan.
@iezioaudi22
@iezioaudi22 4 ай бұрын
thank you!
@sparkle3024
@sparkle3024 9 ай бұрын
You are an angel this was so helpful 🩷
@shirish2005
@shirish2005 Жыл бұрын
best explanation
@weiyaoli6977
@weiyaoli6977 Жыл бұрын
just fantastic
@Politics4Fun
@Politics4Fun Ай бұрын
Awesome ✨
@beastdunk23
@beastdunk23 3 ай бұрын
dude keep it up
@tanoybhowmick8715
@tanoybhowmick8715 Жыл бұрын
Great content
@sagardash1805
@sagardash1805 Жыл бұрын
Neet explanation ❤❤
@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
@HoodieBlock
@HoodieBlock 5 ай бұрын
This is Awesome. Now I can reference this video if I need in my contents. Thank you so much.
@abhaytiwari5991
@abhaytiwari5991 Жыл бұрын
Thanks dude 😎
@aguy9836
@aguy9836 Ай бұрын
thank you
@yuliiakovalova1437
@yuliiakovalova1437 Жыл бұрын
Thank you!!!
@fredteixeira3604
@fredteixeira3604 Жыл бұрын
Sqrt time is used with prime and composite numbers calculations. It might be used in cryptography
@Cruzylife
@Cruzylife Жыл бұрын
this is awesome
@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 🎉
@tanoybhowmick8715
@tanoybhowmick8715 Жыл бұрын
Thanks
@illiachalyk195
@illiachalyk195 Ай бұрын
So sad that KZfaq does not allow you to leave more than one like. Amazing video!
@alekjatuszyk4976
@alekjatuszyk4976 Жыл бұрын
damn this is a really good video. 20 min, and i understand it :)
@gh_st32
@gh_st32 Жыл бұрын
Which program do you use for your drawings?
@ibrahemmohamed4615
@ibrahemmohamed4615 Жыл бұрын
thx so much what is the program used for drawing ?
@eldarmammadov9917
@eldarmammadov9917 Жыл бұрын
Just great
My Brain after 569 Leetcode Problems
7:50
NeetCode
Рет қаралды 2,4 МЛН
Learn Big O notation in 6 minutes 📈
6:25
Bro Code
Рет қаралды 197 М.
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 20 МЛН
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 21 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 75 МЛН
Top 7 Data Structures for Interviews Explained SIMPLY
13:02
Codebagel
Рет қаралды 108 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 86 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,5 МЛН
4 Steps to Solve Any Dynamic Programming (DP) Problem
0:57
Greg Hogg
Рет қаралды 226 М.
Top 7 Algorithms for Coding Interviews Visualized
33:45
Kantan Coding
Рет қаралды 19 М.
Big O Notation - Full Course
1:56:16
freeCodeCamp.org
Рет қаралды 532 М.
Most Common Concepts for Coding Interviews
6:08
NeetCode
Рет қаралды 269 М.
Трагичная История Девушки 😱🔥
0:58
Смотри Под Чаёк
Рет қаралды 376 М.
Цифровые песочные часы с AliExpress
0:45
What’s your charging level??
0:14
Татьяна Дука
Рет қаралды 7 МЛН
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 8 МЛН
Как я сделал домашний кинотеатр
0:41
RICARDO
Рет қаралды 1,5 МЛН