Binary Search Animated

  Рет қаралды 19,919

Dreams of Code

Dreams of Code

Күн бұрын

Binary search is a simple yet elegant algorithm for searching for values in a data structure such as an array.
Despite this simplicity, however, Binary Search also happens to be incredibly important, due to the efficiency it provides. This efficiency enables searches to take place on millions of items in orders of magnitude less time.
This video seeks to show what Binary Search is, through animation and motion.
This video was made possible by the wonderful supporters of this channel.

Пікірлер: 71
@fateriddle14
@fateriddle14 11 күн бұрын
I hope people support these type of videos, instead of those IT drama shows.
@Eckster
@Eckster 11 күн бұрын
Agreed, good content right here
@dboydomr
@dboydomr 11 күн бұрын
What is an It drama show?
@XDarkGreyX
@XDarkGreyX 11 күн бұрын
Uhm... and if people enjoy those? Also, they can enjoy both types....
@muhammadnaqi4242
@muhammadnaqi4242 11 күн бұрын
The quality of the animation of this video is really really impressing.
@dreamsofcode
@dreamsofcode 11 күн бұрын
Thank you!
@paddingbox9845
@paddingbox9845 11 күн бұрын
@@dreamsofcode nice work
@SecretX1
@SecretX1 11 күн бұрын
@@dreamsofcode How do you create these animations? That could be the topic of a future video. Keep the good work!
@dreamsofcode
@dreamsofcode 11 күн бұрын
​@@SecretX1 Pretty much all of this was done using Adobe Illustrator and After Effects! I def had to learn a lot. Absolutely would love to do a video on it! There's also some code with after effects expressions.
@robertwhite3503
@robertwhite3503 11 күн бұрын
Most arrays are small. A linear scan is fine for small arrays. Larger amounts of data are typically stored in databases which do not used arrays (generally) and are generally based on B-tree as mentioned in the video. B-tree is quite different from binary trees in concept.
@no-tomorrow7425
@no-tomorrow7425 11 күн бұрын
Yeah, I agree with this point. For large amounts of data one usually just uses the search functionality offered by databases... no need to implement search from scratch (unless one works for a database company :) )
@angeldude101
@angeldude101 11 күн бұрын
"B-tree is quite different from binary trees in concept." What do you mean? Is a binary tree not simply a B-tree where the minimum and maximum number of child nodes are 0 and 2 respectively? Yes, binary trees are often balanced, but they don't strictly have to be, and B-trees are usually balanced too, though in a slightly different manner.
@avishjha4030
@avishjha4030 11 күн бұрын
Elegant as always! Also, nice play there with the git dates and commit messages!
@nessitro
@nessitro 11 күн бұрын
I'll share this one with my friends, very informative!
@bibekjha5628
@bibekjha5628 11 күн бұрын
Loved the video and the animation just great hope to see more of this kind of video may be one on breadth first search. ❤️
@conaticus
@conaticus 11 күн бұрын
Amazing video as always! If only everybody taught this efficiently on KZbin 😄
@joshi1q2w3e
@joshi1q2w3e 8 күн бұрын
Please make more of these! This was amazing!
@dreamsofcode
@dreamsofcode 8 күн бұрын
I will do!
@phpsoftwareengineering
@phpsoftwareengineering 11 күн бұрын
Such a great video! Thanks!
@dreamsofcode
@dreamsofcode 11 күн бұрын
Thank you! I'm glad you enjoyed it
@GabrielFury-mg8du
@GabrielFury-mg8du 11 күн бұрын
I love your appreciation of Lost
@dreamsofcode
@dreamsofcode 11 күн бұрын
My go to set of numbers! I'm glad you noticed haha
@momensy2136
@momensy2136 11 күн бұрын
I really feel so lucky that i found your channels Please keep up on the content, can't wait to see your channel grows well and get what it deserves ❤🔥.
@dreamsofcode
@dreamsofcode 11 күн бұрын
Thank you! I appreciate that a lot!
@luigidabro
@luigidabro 11 күн бұрын
This video is the greatest example of explanation. You even care for edge cases of the algorithm. I love that detail at 2:01. The animations are great, too! This video is truly a masterpiece.
@dreamsofcode
@dreamsofcode 11 күн бұрын
Thank you so much! I'm really glad people enjoy it! Was a complete labor of love :)
@__________________________6910
@__________________________6910 5 күн бұрын
Thanks 🙏
@robin-lol
@robin-lol 11 күн бұрын
Nice little XZ reference you snuck in 🤭
@doryan08
@doryan08 11 күн бұрын
Please do more videos about other algorithms and their application on real life like Dijkstra or A*. The animation that you use is very useful to understand those.
@kurshadqaya1684
@kurshadqaya1684 8 күн бұрын
Awesom!
@bastiana3611
@bastiana3611 10 күн бұрын
I really enjoy it when you give examples of when stuff is used like how you compared when to use linear search vs binary search here. I'd love to see more of that! :)
@paddingbox9845
@paddingbox9845 11 күн бұрын
I really enjoyed it, especially the awesome animations. question: If I want to learn data structures and algorithms, where should I begin? Can you recommend a KZbin channel?
@dreamsofcode
@dreamsofcode 11 күн бұрын
I haven't found many channels with DSA content personally but I'm sure there are some out there! It'll take me a while to build out my DSA collection. I personally learnt from some great books! I heard that Grokking algorithms is a good one as well which I plan on reading soon
@paddingbox9845
@paddingbox9845 10 күн бұрын
@@dreamsofcode yes! there are plenty out there. I found Neso Academy interesting. I also checked out the book you suggested. btw I love your content and nvim setup. I look forward to more!!
@jaddadzakaria
@jaddadzakaria 11 күн бұрын
Hey, i just want to know with what tool do you make this smooth and beautiful presentations and thanks guys
@dreamsofcode
@dreamsofcode 11 күн бұрын
This was done pretty much exclusively with Adobe After Effects for the animations, and Davinci Resolve for the final editing!
@berndeckenfels
@berndeckenfels 11 күн бұрын
Unlike b- or binary trees a sorted array has zero (pointer) overhead, so it’s great when it can be pre-calculated and is static.
@a1mer06
@a1mer06 11 күн бұрын
I wish I had this video back in my first Uni semester 😭
@dr_regularlove
@dr_regularlove 11 күн бұрын
Would love a video going into the differences between binary trees and B-trees.
@dreamsofcode
@dreamsofcode 11 күн бұрын
Absolutely! I'll add that to my backlog 😁
@angeldude101
@angeldude101 11 күн бұрын
A binary search splits the remaining nodes into two at each node. Similarly, you can make a "ternary search", where you check 2 roughly evenly spaced nodes to determine which of 3 sectioning the desired node is in. A B-tree is ultimately a "variable-ary search tree", where the number of immediate children of a given node isn't a fixed 2 or 3, but can vary depending on the situation, such as based on how many nodes will fit within a pre-decided maximum size when the nodes themselves might not necessarily have a constant size (though they should be the same within a given node to enable random access). Often, finding which child node has a desired value is done with a linear search of the values in the current node.
@dr_regularlove
@dr_regularlove 11 күн бұрын
@@angeldude101 Thanks for that, yeah I can see how this would lend itself well to use cases such as DB indexing, especially with tunable parameters like that pre-decided maximum size with variably sized nodes like you mentioned. Still would love to see a Dreams of Code style video going into it with the minimalist visual aids that imo can go a long way in terms of really impressing a concept into the brain.
@frd85
@frd85 11 күн бұрын
awesome video
@uomolercio1992
@uomolercio1992 11 күн бұрын
Can you do quicksort and mergesort?
@dreamsofcode
@dreamsofcode 11 күн бұрын
I absolutely can!
@Aveniix.
@Aveniix. 3 күн бұрын
Can you do a neovim setup for c#? Thanks
@anthonyraf
@anthonyraf 11 күн бұрын
In french we call it "recherche dichotomique". But the array needs to be sorted first.
@ericlindell3777
@ericlindell3777 11 күн бұрын
Great vid!
@dreamsofcode
@dreamsofcode 11 күн бұрын
Thank you!
@lemonadeforlife
@lemonadeforlife 9 күн бұрын
Nice Animation but as a Linux User. I have one question, in fact it's just a simple question. Did you resort to windows for producing this animation?(y/n)
@dreamsofcode
@dreamsofcode 9 күн бұрын
I did not! I resorted to macOS 😭 My next plan is to use windows in a VM with pcie passthrough
@lemonadeforlife
@lemonadeforlife 5 күн бұрын
@@dreamsofcode After careful consideration and many decisions later, we came to the conclusion that since it's not a Window. And macOS is UNIX based. Congratulations🎉! Your "I use arch btw" license is not going to terminate. Have a good day🐧
@dreamsofcode
@dreamsofcode 5 күн бұрын
@@lemonadeforlife I'm on a provisional probation with it!
@shuaibkhan7775
@shuaibkhan7775 11 күн бұрын
Hoping for B-tree ds in the next video
@greasedweasel8087
@greasedweasel8087 11 күн бұрын
5:54 the only thing better than the Lost reference is the rest of the video
@obiwanjacobi
@obiwanjacobi 10 күн бұрын
Note that CPUs with cache lines and prefetching (like x86), linear search until a couple of MB is the fastest you can get. It is easy to do the benchmarks yourself.
@angeldude101
@angeldude101 11 күн бұрын
One of the reasons to prefer linear search over binary search is the cache, since reading one value will make the CPU implicitly fetch the values around it, and if you can use those rather than discarding all of them and jumping away, then the fewer data transfers can actually trump the fewer operations of the binary search. However it is actually possible to get the best of both worlds, with fewer comparisons while still respecting the cache. It just requires an unusual form of sorting. The structure is similar to an array-backed heap, but the order of the nodes is that of a traditional binary search tree. This type of structure was first described by Michaël Eytzinger in 1590 for efficiently searching through genealogical data and a person's ancestry... on paper.
@fahimferdous1641
@fahimferdous1641 11 күн бұрын
new CS playlist loading?
@dreamsofcode
@dreamsofcode 11 күн бұрын
You've found me out! 😄
@paddingbox9845
@paddingbox9845 11 күн бұрын
@@dreamsofcode I can't wait!!
@Redyf
@Redyf 11 күн бұрын
hello everynyan
@yugalkhanal6967
@yugalkhanal6967 11 күн бұрын
first
@goporororo7404
@goporororo7404 11 күн бұрын
I was first
@Simple_OG
@Simple_OG 11 күн бұрын
code aesthetic, dreams of code similar logo similar video style so much confusion
@goporororo7404
@goporororo7404 11 күн бұрын
1 min no views
@goporororo7404
@goporororo7404 11 күн бұрын
Bro fell off
@goporororo7404
@goporororo7404 11 күн бұрын
Bro fell off
@jatinjoshi9897
@jatinjoshi9897 11 күн бұрын
0 minutes ago is crazy!
@ththththththththth
@ththththththththth 11 күн бұрын
4 8 15 16 23 42
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
You Are WRONG About 0 Based Indexing
25:02
ThePrimeTime
Рет қаралды 186 М.
Тяжелые будни жены
00:46
К-Media
Рет қаралды 4,3 МЛН
ПЕЙ МОЛОКО КАК ФОКУСНИК
00:37
Masomka
Рет қаралды 9 МЛН
the new PS4 jailbreak is sort of hilarious
12:21
Low Level Learning
Рет қаралды 470 М.
8 ways JavaScript is just... different.
12:43
Dreams of Code
Рет қаралды 57 М.
The purest coding style, where bugs are near impossible
10:25
Coderized
Рет қаралды 841 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 252 М.
Has Generative AI Already Peaked? - Computerphile
12:48
Computerphile
Рет қаралды 637 М.
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 127 М.
Testcontainers have forever changed the way I write tests
12:11
Dreams of Code
Рет қаралды 100 М.
zig is the future of programming. here's why.
9:34
Low Level Learning
Рет қаралды 160 М.
One of the most common mistakes in Go is about to be fixed
4:10
Dreams of Code
Рет қаралды 27 М.
Переходник для IPhone • 181649538                         Делюсь обзорами в профиле @lykofandrei
0:15
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Рет қаралды 6 МЛН
Обманет ли МЕНЯ компьютерный мастер?
20:48
Харчевников
Рет қаралды 176 М.
#Shorts Good idea for testing to show.
0:17
RAIN Gadgets
Рет қаралды 3,6 МЛН