Binary search in 4 minutes

  Рет қаралды 142,468

Michael Sambol

Michael Sambol

Күн бұрын

Пікірлер: 73
@theatticbywik8238
@theatticbywik8238 2 жыл бұрын
another day, another person's semester you just saved
@MichaelSambol
@MichaelSambol 2 жыл бұрын
Boom! Awesome.
@masterhimanshu8467
@masterhimanshu8467 7 ай бұрын
Lmao I am having my practical today and I am doing this now... That too without laptop... 😂 And I have to do it in C language lol
@harshvardhansingh5507
@harshvardhansingh5507 Жыл бұрын
CS UG student here, you are precise and to the point which makes you different from rest of the creators
@MichaelSambol
@MichaelSambol Жыл бұрын
great to hear!
@NeerajSamshette
@NeerajSamshette Жыл бұрын
Best video on binary search I've found, straight to the point with well made animations. Thanks a lot Michael!
@nalskipper7447
@nalskipper7447 Жыл бұрын
Thank you for using a black background and white text. All of your older sorting algorithm videos were really helpful.
@MichaelSambol
@MichaelSambol Жыл бұрын
you're welcome, thanks for watching!
@amitos1646
@amitos1646 Жыл бұрын
Damn. I am commenting a bit late but man it's people like you who help me keep on coding and not giving up. Thank you! Amazing content.
@MichaelSambol
@MichaelSambol Жыл бұрын
Thanks bro! Keep going 💪🏼
@duelingo8731
@duelingo8731 5 ай бұрын
u r singlehandedly making algorithms easy for people keep it upppppp
@glenn7422
@glenn7422 Жыл бұрын
such a great explanation, I love your calmness
@MichaelSambol
@MichaelSambol Жыл бұрын
thank you!
@BirukBelayneh-rq2we
@BirukBelayneh-rq2we 3 ай бұрын
damn, this is amazing and exactly what i wanted as a python beginner currently. thanks Michael
@sudhirms6507
@sudhirms6507 Жыл бұрын
Ur the goat bro I just watch ur vids 1 hr before the exam and covered the entire 5 months syllabus ,🔥🔥
@theanamex9969
@theanamex9969 2 жыл бұрын
Your code is so simple and easily understandable, it helped a lot. My professor had 3 slides on it, very yuck. Thank you so much!
@DavidZapata-q4n
@DavidZapata-q4n 8 ай бұрын
I watched previously the video where you explain the Big-O Notation, in it you showed ant the end that in a "IF -> ELSEIF -> ELSE" the time complexity would be O(n^2). At 2:47 there was an "IF -> ELSEIF -> ELSE" why is the time complexity in this case O(log n) and not O(n^2)?
@MichaelSambol
@MichaelSambol 8 ай бұрын
Might be helpful to watch the whole playlist on analyzing algorithms: kzbin.info/aero/PL9xmBV_5YoZMxejjIyFHWa-4nKg6sdoIv
@Neb_Explains
@Neb_Explains Жыл бұрын
0:35 generally it will be rounding down since int always kind off round down by default in more languages
@Anonymous-ri4mk
@Anonymous-ri4mk 5 ай бұрын
Oh this makes it so much easier i was watching the visualisation but i just get confused lol since i am not very perceptive thank you this helps a lot
@Czarcasm.
@Czarcasm. 7 ай бұрын
reviewing for a data structures quiz rn, this was exactly what i was looking for! 💪very clear and helpful explanation :3
@hojongyu8243
@hojongyu8243 Жыл бұрын
Amazing explanation. Thank you!
@yorgodev
@yorgodev 2 жыл бұрын
Cool stuff Michael! Keep up the great work!
@okok-sc2cx
@okok-sc2cx 2 жыл бұрын
Please please please keep making videos, I watch your videos everyday, you make my day, thank you
@MichaelSambol
@MichaelSambol 2 жыл бұрын
More coming! 4 weddings in October stalled my progress. Thank you for watching!
@ZandalfBunt
@ZandalfBunt 2 жыл бұрын
@@MichaelSambol 4 wives? As expected of Mr. Sambol.
@anirudh4946
@anirudh4946 2 жыл бұрын
Nicely explained!
@MichaelSambol
@MichaelSambol 2 жыл бұрын
thank you! I appreciate you watching.
@t_ahmad
@t_ahmad 2 жыл бұрын
Great Explaination! Could you make a video on Linear Search is well? :)
@SunsetsOverBatteryCity
@SunsetsOverBatteryCity 8 ай бұрын
Him: “quick sort=pivot” Me: “WHILE HE HID IN RADIO WE PIVOTED TO VIDEO 🗣️💥”
@eliyoung9406
@eliyoung9406 8 ай бұрын
Bro is actually a godsend
@enebenzer-p6t
@enebenzer-p6t 7 ай бұрын
can you make one on linear searches
@techytech07
@techytech07 Жыл бұрын
Just a quick question, after finding the average of index, if that mid position happens to land on the target index, does the search stop and the target is found?
@MichaelSambol
@MichaelSambol Жыл бұрын
yep. see code here: github.com/msambol/youtube/blob/master/search/binary_search.py
@techytech07
@techytech07 Жыл бұрын
@@MichaelSambol Great! thanks a lot
@jakubrembiasz8942
@jakubrembiasz8942 7 ай бұрын
amazing video keep it up!
@Jkauppa
@Jkauppa Жыл бұрын
hey, try median bucket sort, its 2n log n, ie, first linear median search O(n) then split the elements to two buckets, repeat for sub-buckets
@sweetphilly2
@sweetphilly2 Жыл бұрын
Curious if it would behoove the algorithm to check if either left, right, or mid is the answer
@ziyad7780
@ziyad7780 2 жыл бұрын
i like your explanation:) keep it up
@vraimoi
@vraimoi 7 ай бұрын
great vid man keep it up
@doodle_mo_ka4336
@doodle_mo_ka4336 Жыл бұрын
bro should be known by more people
@magma6554
@magma6554 2 жыл бұрын
you are a legend
@MrBurn666
@MrBurn666 Жыл бұрын
Whats the purpose of returning specifically -1 if the target value is not found? Why not simply state that the target wasnt found?
@MichaelSambol
@MichaelSambol Жыл бұрын
Can do either :)
@nurpaujiana4664
@nurpaujiana4664 3 ай бұрын
thanks bro, iam understand now
@stutipande2542
@stutipande2542 Жыл бұрын
why do we return -1?
@MichaelSambol
@MichaelSambol Жыл бұрын
returning -1 if key is not in the array. otherwise return the key: github.com/msambol/dsa/blob/master/search/binary_search.py#L9
@rain_yy
@rain_yy 9 ай бұрын
nice explanation but how do i know the time complexity?
@rain_yy
@rain_yy 9 ай бұрын
do i calculate or something? hehe
@MichaelSambol
@MichaelSambol 8 ай бұрын
Take a look here, this should help: kzbin.info/aero/PL9xmBV_5YoZMxejjIyFHWa-4nKg6sdoIv
@rain_yy
@rain_yy 8 ай бұрын
thank you Sir !! @@MichaelSambol
@jwinwithin5124
@jwinwithin5124 7 ай бұрын
what if the number 29, how will it work
@MichaelSambol
@MichaelSambol 7 ай бұрын
Try it here :) github.com/msambol/dsa/blob/master/search/binary_search.py
@migy220
@migy220 Ай бұрын
can someone explain to me why the average of (0,13) = 6 , average of (0,5) = 2? thank you!
@MichaelSambol
@MichaelSambol Ай бұрын
Rounding down
@nerfornada-
@nerfornada- Жыл бұрын
THANK YOU
@kafychannel
@kafychannel Жыл бұрын
thank you so much !
@ZFlyingVLover
@ZFlyingVLover 2 жыл бұрын
These search routines are canned so you can just grab them and use them
@folklore6270
@folklore6270 Жыл бұрын
lifesaver
@zea7452
@zea7452 2 жыл бұрын
Why not return array[mid], why return mid I don't understand
@MichaelSambol
@MichaelSambol 2 жыл бұрын
The code returns the index/location of the element you're searching for: github.com/msambol/youtube/blob/master/search/binary_search.py.
@maxheinwal5084
@maxheinwal5084 10 ай бұрын
if you return array[mid], you would return the number you are looking for, because mid is the index of the wanted number.
@bossmusa9075
@bossmusa9075 Жыл бұрын
thank you
@VitorRaimundo1710
@VitorRaimundo1710 Жыл бұрын
👏👏
@head-lag
@head-lag 2 жыл бұрын
niceeee
@kobey3044
@kobey3044 Жыл бұрын
There are 14 numbers in this LIST.. so Average should be (0,14)=7
@MichaelSambol
@MichaelSambol Жыл бұрын
It's by index in the array... so 0 and 13. See code here: github.com/msambol/dsa/blob/master/search/binary_search.py
@kobey3044
@kobey3044 Жыл бұрын
@@MichaelSambol Thank you!!! =)
@luislambert6955
@luislambert6955 2 жыл бұрын
𝓅𝓇𝑜𝓂𝑜𝓈𝓂 ✔️
Breadth-first search in 4 minutes
3:59
Michael Sambol
Рет қаралды 342 М.
Binary Search Animated
7:00
Dreams of Code
Рет қаралды 39 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 537 М.
B-trees in 4 minutes - Intro
3:57
Michael Sambol
Рет қаралды 142 М.
Merge sort in 3 minutes
3:03
Michael Sambol
Рет қаралды 1,3 МЛН
Binary Search Algorithm | Binary Search in C++
4:22
CodeWithArish
Рет қаралды 348
Bellman-Ford in 4 minutes - Theory
3:57
Michael Sambol
Рет қаралды 339 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
What is mathematical thinking actually like?
9:44
Benjamin Keep, PhD, JD
Рет қаралды 25 М.
you will never ask about pointers again after watching this video
8:03
B-trees in 6 minutes - Properties
5:38
Michael Sambol
Рет қаралды 58 М.
Depth-first search in 4 minutes
4:01
Michael Sambol
Рет қаралды 308 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН