Topics / DSA
🧠
DSA
Data Structures and Algorithms — the foundation behind every coding interview and every efficient program.
Why learn DSA?
-
The shared vocabulary of every coding interview at every company.
-
Lets you reason about performance before you write the code.
-
Sharpens problem-solving in a way nothing else does.
-
A single skill that compounds across every language and framework.
What you can build with DSA
Cracking technical interviews Writing code that scales Reading other engineers' code faster Competitive programming and contests
DSA tutorials
277 articles · page 1 of 14Hand-written tutorials, ordered as a recommended learning path.
- 01 Subarray Sums Master subarray sum techniques — prefix sum for range queries, Kadane's algorithm for maximum subarray, hash map for subarray sum equals K, sliding window, and maximum product subarray.
- 02 Recursion to Iteration Learn to convert recursive algorithms to iterative ones. Covers tail recursion, explicit stacks, iterative tree traversals, Morris traversal, and memoization as a bridge to DP.
- 03 Merge Sort Master merge sort — recursive splitting, merging sorted halves, counting inversions, merge sort on linked lists, stability analysis, and O(n log n) guaranteed performance with Python.
- 04 Quick Sort Master quick sort — Lomuto and Hoare partitions, pivot strategies, worst case analysis, Dutch National Flag, QuickSelect for kth element, and comparison with merge sort.
- 05 Non-Comparison Sorts Break the comparison sort barrier with counting sort, radix sort (LSD and MSD), and bucket sort — Python implementations, stability analysis, and when to use each non-comparison sort.
- 06 Matrix Traversals Master matrix traversal patterns — spiral order, diagonal traversal, zigzag, boundary traversal, matrix rotation, transpose, search in 2D matrix, and set matrix zeroes with Python.
- 07 Hash Map Internals Deep dive into hash map internals -- hash functions, collision resolution (chaining vs open addressing), load factor, rehashing, and building a hash map from scratch in Python.
- 08 Queues & Deques Master queue variants — simple queue, deque, circular queue, and priority queue. Implementations in Python with BFS, sliding window, and scheduling examples.
- 09 Circular Queue Build a circular queue from scratch — understand ring buffers, front/rear pointer math with modulo, full vs empty detection, and real-world uses in OS scheduling.
- 10 Doubly & Circular LL Master doubly linked lists with prev/next pointers, insertion and deletion at any position, circular linked list variants, and real-world use cases like browser history.
- 11 Cycle Detection Learn Floyd's tortoise and hare algorithm for cycle detection in linked lists — detect cycles, find the start, measure cycle length, with full Python code and proofs.
- 12 Reversal Patterns Master every linked list reversal pattern — iterative, recursive, reverse in groups of K, and reverse between positions m and n, with Python code and common pitfalls.
- 13 Merge & Sort Learn to merge two sorted lists, merge K sorted lists with a heap, and implement merge sort on linked lists with full Python code and complexity analysis.
- 14 Intersection Point Find where two linked lists intersect using the two-pointer technique, length difference method, and hash set — with Python implementations and complexity analysis.
- 15 LL Palindrome Learn three ways to check if a linked list is a palindrome — stack-based O(n) space, reverse-second-half O(1) space, and recursive. Step-by-step walkthroughs with Python code and Big-O analysis.
- 16 Remove Nth Node Master the two-pointer gap technique to remove the nth node from the end in a single pass. Covers the dummy node trick, edge cases like removing the head and single-node lists, with Python code and Big-O analysis.
- 17 Add Two Numbers Learn to add two numbers represented as linked lists — both reverse order (LeetCode 2) and forward order (LeetCode 445). Covers carry handling, different-length lists, and Python implementations with Big-O analysis.
- 18 Flatten LL Learn to flatten a multilevel doubly linked list (LeetCode 430) and flatten sorted linked lists. Covers iterative and recursive DFS approaches with Python implementations and Big-O analysis.
- 19 Copy Random Pointer Learn two approaches to deep copy a linked list with random pointers — HashMap O(n) space and the interleaving O(1) space technique. Step-by-step walkthroughs with Python code and Big-O analysis.
- 20 Reorder List Learn how to reorder a linked list by interleaving first and last nodes — find the middle, reverse the second half, and merge alternating. Full Python code, step-by-step walkthrough, and Big-O analysis.