Algorithms You Should Know Before System Design Interviews

  Рет қаралды 198,773

ByteByteGo

ByteByteGo

Күн бұрын

Get a Free System Design PDF with 158 pages by subscribing to our weekly newsletter: bytebytego.ck.page/subscribe
Animation tools: Adobe Illustrator and After Effects.
Checkout our bestselling System Design Interview books:
Volume 1: amzn.to/3Ou7gkd
Volume 2: amzn.to/3HqGozy
The digital version of System Design Interview books: bit.ly/3mlDSk9
ABOUT US:
Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.

Пікірлер: 89
@alex.semeniuk
@alex.semeniuk 10 ай бұрын
00:00 Intro 00:41 Consistent Hashing 01:47 Geohash 02:02 Quadtree 02:33 Leaky Bucket 03:05 Token Bucket 03:19 Trie 04:30 Bloom Filter 05:18 Consensus algorithms Thanks for the video!
@TheJacrespo
@TheJacrespo 10 ай бұрын
BTW. while the video tells you to focus on high-level algorithmic concepts, I'd say don't underestimate the power of diving into the code. Those little details can make or break a system. The video praises virtual nodes in consistent hashing, but you should know that adding these can complicate things, and they are not always needed. Consistent hashing is great for Big Data, but it wont solve every problem-like hot-spotting, where some nodes get overloaded. The Leaky Bucket algorithm sounds pretty coold on paper, but have you considered request starvation or the need for a separate queuing system? Tries are efficient for string searches, but they can eat up memory like there's no tomorrow. And let's not forget Bloom filters; they're quick for caching and analytics, but what about false positives? The video mentions Kafka and SCD but trust me, implementing these algorithms in a real-world, large-scale system is a whole different ball game, yep , dude!
@kedi9987
@kedi9987 9 ай бұрын
What alternatives do you suggest to address the challenged posed by the above options ?
@TheJacrespo
@TheJacrespo 9 ай бұрын
@@kedi9987 sure ### Consistent Hashing -HRW Hashing: HRW (Highest Random Weight) hashing is stateless and provides an even distribution when you lose or gain nodes. It's easier for you to explain and understand compared to Consistent Hashing. ### Leaky Bucket Algorithm 1. Token Bucket Algorithm Unlike the Leaky Bucket you might use, the Token Bucket fills up with tokens at a steady rate. You can only send data packets if a token is available, allowing you to handle bursty data better. 2. Adaptive Leaky Bucket. This is a dynamic version that adjusts the leak rate based on your network conditions. It's more adaptive and could be more efficient for your needs. 3. Priority Queuing: If you use a priority queue alongside the Leaky Bucket, you can manage different types of traffic more efficiently. High-priority packets would get processed faster. ### Tries 1. Hash Tables: If you're dealing with languages that have large alphabets, hash tables could be more memory-efficient 2. Radix Trees: Also known as compressed tries, these trees store multiple characters in a single node. This could save you some memory. 3. Variable-Length Arrays in Node: You could use variable-length arrays in each node, sorted by frequency, to save space. This is particularly useful if your trie is sparse. ### Bloom Filters 1. Cuckoo Filters. These filters allow you to remove items dynamically and offer better space efficiency. 2. Quotient Filters. These are more memory-efficient and allow you to perform more advanced set operations like union and intersection. 3. Counting Filters If you need to remove elements, Counting Filters use counters instead of bits. This could offer you more flexibility.
@peregrin71
@peregrin71 9 ай бұрын
I agree, for system design the SOLID principles (separation of concerns), interfaces/dependency injection and unit testability are far more important than specific algorithms. These up to a point are implementation details and can always be replaced/fine tuned to data at hand (correctness first). I am not saying they are not important, but they should come second.
@JoseCarlosVM
@JoseCarlosVM 8 ай бұрын
How will a trie eat up memory like no tomorrow? It's never going to take more space than just storing the entire set of strings by itself
@TheJacrespo
@TheJacrespo 8 ай бұрын
@@JoseCarlosVMyup, but you have to look at the total memory footprint, including the additional overhead of the trie structure: nodes and links to child nodes, not just the strings stored themselves. Just storing 1 million unique strings of average size would occupy approximately 10 MB on their own. Regardless of whether these 1 million strings have overlapping prefixes or not, the memory overhead for the trie structure alone would be around 2 GB. Even with a 50% overlap due to common prefixes, the overhead still stands at more than 1 GB. Additionally, each node could have an array or hash map to represent transitions to child nodes, which could be mostly empty but would still take up space.
@hiagomachado5792
@hiagomachado5792 10 ай бұрын
I found this channel by chance. Very good. It's gold
@warlockpaladin2261
@warlockpaladin2261 9 ай бұрын
I would love to see videos like this covering R-trees and KD-trees. 👨‍💻
@robertwallace5498
@robertwallace5498 10 ай бұрын
amazing video! gave me some homework to do which is awesome
@n_0_body
@n_0_body 6 ай бұрын
Love BIG brain. There is a lot to learn here. Thank you, I have to subscribe.
@NikitaYVolkov
@NikitaYVolkov 10 ай бұрын
Another worthy algorithm is Hash Array Mapped Trie. It is a cornerstone of all modern functional programming languages.
@mss3784
@mss3784 10 ай бұрын
Thank you...
@13thravenpurple94
@13thravenpurple94 9 ай бұрын
Good stuff 👍 Thank you 💜
@kingcw168
@kingcw168 10 ай бұрын
a video about multi-region system that abides to data localization law would be nice
@krishnamurthymadaraboina1556
@krishnamurthymadaraboina1556 2 ай бұрын
i don't know any of them, that means there is lot to learn. thanks for the video.
@amitkhaware290
@amitkhaware290 9 ай бұрын
Perhaps, if all these algos covered one by one as part of separte videos in details then that would be appreciable.
@khilisharma2243
@khilisharma2243 5 ай бұрын
They have covered them in here beginning with consistent hashing first kzfaq.info/get/bejne/i6xpfNSezJ-YpJ8.htmlsi=8rpEiCTd3s3_V1fS
@Antonio-yy2ec
@Antonio-yy2ec 10 ай бұрын
Pure gold!!!
@dannyhd8301
@dannyhd8301 18 күн бұрын
Those algorithms needed their own video, with pseudo-code and scenario-based example
@Zmey5656
@Zmey5656 23 күн бұрын
You need a course in system design, and I would buy it)))
@ashu3403
@ashu3403 10 ай бұрын
Have you guys made a video about things to know before system design?
@__hannibaal__
@__hannibaal__ 7 ай бұрын
I m still developing(c/c++) a Generalization of kd-tree and quad-oct…-trees, special trees. All - in - one structure.
@diegoarmandoRey
@diegoarmandoRey 10 ай бұрын
Great, thanks
@EmonKhan-rk
@EmonKhan-rk 10 ай бұрын
How you edit your video? What is the name of the app?
@MarcoLenzo
@MarcoLenzo 10 ай бұрын
I found this video hard to follow compared to the rest. Too much packed in it. I feel suddenly incredibly dumb lol
@miguemesch
@miguemesch 10 ай бұрын
I feel exactly the same
@FrancescoZorziKimi
@FrancescoZorziKimi 10 ай бұрын
Me too
@alinmoai4597
@alinmoai4597 10 ай бұрын
me too
@aa-ox5qr
@aa-ox5qr 10 ай бұрын
me too
@VincentJenks
@VincentJenks 9 ай бұрын
Yeah, I’m gonna go looking for overly-simplistic examples of these in action, in a language I can follow…like JavaScript. I need to see implementations to really internalize the concept.
@lucemiserlohn
@lucemiserlohn 9 ай бұрын
Claims: Algorithms Reality: Muddy conflagration of Data Structures and Algorithms, most of which are special cases of the more important generic ones
@lucemiserlohn
@lucemiserlohn 5 ай бұрын
@bntheyoutube The entire premise of teaching is not going into special cases. The entire purpose of teaching a single thing is not mixing it with other stuff. Btw, if there is anybody spreading hateful stuff in the comment, it is your attitude. Don't project your inferiority complex on me, dude.
@tysontakayushi8394
@tysontakayushi8394 5 ай бұрын
@@lucemiserlohn wtf? You seem so dumb
@andru5054
@andru5054 10 ай бұрын
sick
@mousumisaha4525
@mousumisaha4525 10 ай бұрын
What tool/editor do you use for animation, can you please share?
@ARmy2510
@ARmy2510 10 ай бұрын
After Effects.
@sergiocoder
@sergiocoder 18 күн бұрын
Can you explain the difference between leaky bucket and token bucket? They seem exactly the same to me... unless the token bucket can hold an unlimited number of tokens...
@user-lh7bo8ec6b
@user-lh7bo8ec6b 8 ай бұрын
What was this video made of?
@antonytran229
@antonytran229 7 ай бұрын
Where is merkle tree ?. It is very important in distributed systems
@JustinShaedo
@JustinShaedo 9 ай бұрын
I Think people are getting confused because they think this is advice for programming interviews. It's really not. As the title says, It's System Design; which is relevant in 0.01% of coding interviews (that's being generous). If you're on track to be designing say systems that run server balancing then you'll (hopefully) know these already (if not, you'll need more than a basic YT summary!); but if you're a say a web dev, games dev, making IOT things, data analytics, most AI, etc etc etc etc etc etc etc etc etc then the majority of this is unlikely to be relevant (you'll use these most days, but it won't be you determining the design) I've programmed quad trees for games now game engines (eg Unreal, Unity, etc) do that for you. I've programmed quad trees for fire simulation software; but now libraries do that for me. I've developed consistent hashing for server balancing; but now AWS, Azure, etc does this for you. Yes System design concepts are great, and understanding them will only make you a better programmer; but only for a small minority will they be things you'll need to know intimately.
@Misteribel
@Misteribel 7 ай бұрын
Exactly! While I was watching this video I felt like maybe in the 80s or 90s you'd need to know all this as a programmer, and you'd have read all of Knuth's books, but nowadays, libraries and existing systems do that for you. It is true, though, that understanding these will help you make the right decisions. Just like understanding a Von Neumann architecture helps you write more efficient code.
@JustinShaedo
@JustinShaedo 7 ай бұрын
@@Misteribel well said.
@DaiShuryoTechnus
@DaiShuryoTechnus 10 ай бұрын
4:20 For C and C++ only?
@yurcchello
@yurcchello 9 ай бұрын
i wish they charge fee based on time game runs
@khilisharma2243
@khilisharma2243 5 ай бұрын
For those interested, each algorithm has been covered in detail as well kzfaq.info/get/bejne/i6xpfNSezJ-YpJ8.htmlsi=8rpEiCTd3s3_V1fS
@prashant762
@prashant762 10 ай бұрын
Difficult to follow. Didn't catch the algo names used in video. Also, presentation is blurry
@anandnandudkar1419
@anandnandudkar1419 9 ай бұрын
@ ByteBytego pls work on your audio of the video!
@fatcat500
@fatcat500 10 ай бұрын
So in an system design interview, I'm expected to know and utilize these algorithms? Honestly, it seems like if I start talking about some of these, my interviewer will not be familiar with them and just be confused.
@morenoh149
@morenoh149 10 ай бұрын
Depends on the company. If you’re gonna be working on managed systems offered by Google, Aws, azure then yes you need to know these.
@joo02
@joo02 10 ай бұрын
They will know. Trust me
@MarcoLenzo
@MarcoLenzo 10 ай бұрын
​@@morenoh149can you expand on why you think they are important if you use managed systems?
@MarcoLenzo
@MarcoLenzo 10 ай бұрын
I honestly think that knowing them superficially means nothing at all. You can read how much you want but the proof's in the pudding.
@sealoftime
@sealoftime 10 ай бұрын
@@MarcoLenzo it's about being capable to go beyond the framework that you are being given. Just how we expect from Java middles+ candidates to know low-level Java and how the Spring works behind the neat annotation, the same way we expect from seniors and architects to know what kind of load balancing algos there are pros/cons, different kinds of ratelimiting and etc. If engineer is unaware of that, they will take incredibly more time to design a performant and reliable system, because thye are just thinking on a higher level of abstraction. Tbh, if person's only developing monoliths with a load of no more than 100 RPM, then those algos are likely useless for them
@yaroslavozerov1121
@yaroslavozerov1121 9 ай бұрын
this is hard
@VFPn96kQT
@VFPn96kQT 5 ай бұрын
Is it just me, but I've never needed any of these algorithms in interviews
@Amd107
@Amd107 5 ай бұрын
NIce, now I feel like a complete dumb since everything was new to me
@DK-ox7ze
@DK-ox7ze 10 ай бұрын
You have listed Geo hash but not explained it.
@humanrye8696
@humanrye8696 9 ай бұрын
Quadtrees
@bruceliebewilma
@bruceliebewilma 6 ай бұрын
Boom Blackbox algorithm
@bruceliebewilma
@bruceliebewilma 6 ай бұрын
Also, in practice, how consistent are these algorithms?
@TheJacrespo
@TheJacrespo 10 ай бұрын
In today's oversaturated job market for software developers, this good stuff is only the very basic 101 on algorithms and data structures, because there are already millions who know all this. My bet is that you will need much more to stand out from hundreds of applicants for normal positions, or thousands for the big ones.
@heyman620
@heyman620 9 ай бұрын
You don't have SWE experience or you are a googler, right? Because most devs don't even know these, it's just f*cking anecdotes, and generally not very good advice regarding what you should actually learn. People should start with understanding heaps, for example, not bullshit "leaky bucket" (you can derive it in 5 minutes yourself).
@TheJacrespo
@TheJacrespo 9 ай бұрын
​@@heyman620 the movie has changed. LeetCode-style interviews are now standard, even in small companies. With five-stage interviews becoming the norm, you have to be quick and flawless in the behavioral BS as well, just to stand a chance. What was in the video some years ago sure have given applicants an edge, but now it is plain technical crap when you are up against hundreds of candidates, most of whom are thoroughly LeetCode-prepared.
@heyman620
@heyman620 9 ай бұрын
​ @TheJacrespo I understand it man, just grind LeetCode - it's hard for all of us. These algos are mostly not the basics, you need to know common stuff very well. I generally think this video is bad advice. By the way, it also sucked 7+ years ago.
@JustinShaedo
@JustinShaedo 9 ай бұрын
@@TheJacrespo I think heyman620 needs to work on their communication... but... I'm also confident they're right.
@faabi86
@faabi86 8 ай бұрын
​@@TheJacrespothats absolutely the opposite of all my own experiences in the last years and all the experiences of all my real life dev friends.
@patrickdeguzman5804
@patrickdeguzman5804 8 ай бұрын
This script feels like it was written by chatgpt
@peregrin71
@peregrin71 9 ай бұрын
Algorithms are not core to system design, interfaces and decomposision are.
@k.alipardhan6957
@k.alipardhan6957 6 ай бұрын
I dont think this goes deep enough to be useful
@vivekpaliwal1876
@vivekpaliwal1876 3 ай бұрын
You speak very fast..
@anandnandudkar1419
@anandnandudkar1419 9 ай бұрын
@ByteByteGo
Top 5 Most Used Architecture Patterns
5:53
ByteByteGo
Рет қаралды 221 М.
Consistent Hashing | Algorithms You Should Know #1
8:04
ByteByteGo
Рет қаралды 285 М.
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 56 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 57 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 85 МЛН
Caching Pitfalls Every Developer Should Know
6:41
ByteByteGo
Рет қаралды 109 М.
Top 7 Ways to 10x Your API Performance
6:05
ByteByteGo
Рет қаралды 310 М.
Design Twitter - System Design Interview
26:16
NeetCode
Рет қаралды 460 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
How To Choose The Right Database?
6:58
ByteByteGo
Рет қаралды 287 М.
How to Crack Any System Design Interview
8:19
ByteByteGo
Рет қаралды 316 М.
Most Tech Interview Prep is GARBAGE. (From a Principal Engineer at Amazon)
12:57
Back-Of-The-Envelope Estimation / Capacity Planning
8:32
ByteByteGo
Рет қаралды 87 М.
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 56 МЛН