Загрузка...

Stacks, Queues, and Heaps in Real Code

Three small data structures quietly run half the code in your editor. The function call stack is a stack. Every message broker is a queue. Every "give me the top one hundred items" lookup is a heap. They look restricted. That restriction is exactly what makes them fast.

This episode walks through all three. Stacks (LIFO) and the patterns that unlock linear-time solutions to problems that look like they need nested loops. Queues (FIFO) and where they show up in BFS, scheduling, and message brokers like Kafka and RabbitMQ. Priority queues, binary heaps as their backing structure, and the genuinely surprising result that you can build a heap from an unordered array in O(n) instead of O(n log n). Where heaps live in production: Dijkstra's algorithm, OS schedulers, and every top-K problem. Plus the deque, sliding-window's favorite structure.

Built from public docs, papers, talks, and code, then vetted by senior software engineers for correctness, tradeoffs, and real-world failure modes.

0:00 Three restricted structures
0:51 Stack mechanics (LIFO)
1:19 Stacks everywhere: call stack, undo, browser back
1:45 Stack patterns: parens, monotonic stack
2:24 Queue mechanics (FIFO)
2:50 Queues everywhere: BFS, scheduling, brokers
3:15 Priority queue intro
3:38 Binary heap structure
4:11 Heap operations (insert, extract-min)
4:43 Build a heap in O(n)
5:12 Where heaps live: Dijkstra, schedulers, top-K
5:41 The deque (collections.deque)
6:10 Day-to-day takeaways
6:42 Closing, ch05 teaser

Full series playlist: https://www.youtube.com/playlist?list=PLR8zgz1piLsjC7BNBWhUsiKLXWpe-cTpn

Full series (19 chapters):
Ch. 1: Big-O, Growth Curves, and Real-World Performance: https://youtu.be/IuT2yzQwVlE
Ch. 2: Why Linked Lists Lose to Arrays in Real Code: https://youtu.be/XlBaE7xInRk
Ch. 3: How Hash Tables Make O(1) Lookup Real: https://youtu.be/MKcj4p3pp5Q
Ch. 4: Stacks, Queues, and Heaps in Real Code (this video): https://youtu.be/LJdcSLleNEM
Ch. 5: Recursion, Call Stacks, and Memoization: https://youtu.be/kF656IEsnwQ
Ch. 6: Sorting Algorithms, Stability, and Why Timsort Wins: https://youtu.be/kg8ce_549RU
Ch. 7: Binary Search, Bisection, and Ordered Data
Ch. 8: Counting Sort, Radix Sort, and Beating O(n log n)
Ch. 9: Binary Trees, Balanced Trees, and B-Trees in Databases
Ch. 10: Graphs, DAGs, and Dependency Modeling
Ch. 11: BFS, DFS, Topological Sort, and Cycle Detection
Ch. 12: Dijkstra's Algorithm, Heaps, and Shortest Paths
Ch. 13: Bellman-Ford, Negative Weights, and Arbitrage
Ch. 14: Minimum Spanning Trees, Kruskal, Prim, and Union-Find
Ch. 15: Greedy Algorithms, Huffman Coding, and Local Choices
Ch. 16: Divide and Conquer, Recurrences, and the Master Theorem
Ch. 17: Dynamic Programming, Memoization, and Table-Filling
Ch. 18: Dynamic Programming Patterns: LCS, Coin Change, and LIS
Ch. 19: Backtracking, Constraint Search, and Pruning

Current roadmap. More chapters may be added over time.

Subscribe for new chapters.

Subtitles: English

Видео Stacks, Queues, and Heaps in Real Code канала Learning Podcasts
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять