Heap and Priority Queue: The Data Structure Behind Top-K
Learn how heaps power priority queues, why heapq runs push and pop in O(log n), and how to solve classic Top-K and merge problems in Python.
12 posts.
Learn how heaps power priority queues, why heapq runs push and pop in O(log n), and how to solve classic Top-K and merge problems in Python.
Walk through LeetCode 121 Best Time to Buy and Sell Stock. We go from the quadratic brute force to a clean one-pass solution tracking the running minimum.
A complete walkthrough of LeetCode 1 Two Sum. We move from the obvious nested loop to a single-pass hash map and dissect why it works.
A practical introduction to tries: node structure, insert, search, prefix queries, memory tradeoffs, and classic interview problems like word search.
Master C++ control flow with if-else, for and range-for loops, while, do-while, switch, and the modern init-statement syntax for conditions.
Write C++ functions that pass data correctly: by value, by reference, by const reference, with overloading, default arguments, and clear ownership.
Set up a modern C++ toolchain on macOS, Linux, or Windows, then compile and run your first program with g++ or clang++ from the command line.
Understand C++ fundamental types, fixed-width integers, floating point, char, bool, const, and how initialization actually works in modern C++.
Design Java classes that hold state and behavior cleanly. Constructors, encapsulation, static vs instance, records, and the equals plus hashCode contract.
Every branching and looping construct in modern Java, including switch expressions and pattern matching, with examples that mirror real code.
Install a modern JDK, verify the toolchain, and ship your first Java program from the command line without an IDE doing the magic for you.
Master Java primitives, reference types, literals, and casting. Know exactly what each type costs and where overflow and precision will bite you.