Algorithms
Series Overview & How to Use
📋 At a Glance
| Aspect | Details |
|---|---|
| Series Size | 25 articles with interactive visualizers |
| Target Audience | Developers preparing for interviews or wanting quick DSA review |
| Format | Concise cheatsheets with step-by-step visualizations |
| Key Feature | Every article has an interactive visualizer |
🎯 What You'll Learn
This series provides visual, interactive cheatsheets for essential data structures and algorithms:
- Data Structures: ArrayList, LinkedList, HashMap, TreeSet, PriorityQueue, ArrayDeque, and more
- Algorithms: Binary Search, Sorting, Graph Traversal, Dijkstra, Dynamic Programming
- Concurrency: ConcurrentHashMap, BlockingQueue, Copy-on-Write, Immutable Collections
- Advanced: Bloom Filter, B-Tree, Consistent Hashing, Raft Consensus
- Bonus: Garbage Collection visualization, SQL Joins, ArrayList vs LinkedList comparison
📘 Introduction: Why Visual Learning?
Most DSA resources explain with text. This series shows with animations.
Each article follows a consistent, concise format:
- Quick Reference Card - Complexity, use cases, one-liner description
- Interactive Visualizer - Step through operations in real-time
- Key Operations - Code snippets for common operations
- When to Use - Decision guide for choosing this structure
- Common Pitfalls - Mistakes to avoid
- Interview Tips - What interviewers look for
🗂️ Series Structure
📦 Data Structures (Parts 1-8)
| Part | Topic | Key Complexity | Visualizer |
|---|---|---|---|
| 1 | ArrayList | O(1) access, O(n) insert | Dynamic resizing animation |
| 2 | LinkedList | O(1) insert at ends | Node pointer manipulation |
| 3 | HashMap | O(1) average lookup | Hash buckets & collisions |
| 4 | TreeSet/BST | O(log n) sorted ops | Tree insertions & rotations |
| 5 | PriorityQueue | O(log n) extract-min | Heap sift operations |
| 6 | ArrayDeque | O(1) both ends | Circular buffer wrap-around |
| 7 | LinkedHashMap | O(1) + order preserved | Dual hash+list structure |
| 8 | EnumSet | O(1) bit operations | Bit vector visualization |
🔍 Algorithms (Parts 9-13)
| Part | Topic | Complexity | Visualizer |
|---|---|---|---|
| 9 | Binary Search | O(log n) | Search space halving |
| 10 | Sorting | O(n log n) - O(n²) | Side-by-side algorithm race |
| 11 | Graph: DFS & BFS | O(V + E) | Node visit order comparison |
| 12 | Dijkstra | O((V+E) log V) | Distance relaxation steps |
| 13 | Dynamic Programming | Varies | DP table filling |
🔄 Concurrency (Parts 14-17)
| Part | Topic | Key Feature | Visualizer |
|---|---|---|---|
| 14 | ConcurrentHashMap | Lock striping | Concurrent segment access |
| 15 | BlockingQueue | Thread blocking | Producer-consumer pattern |
| 16 | Copy-on-Write | Safe iteration | Copy creation on write |
| 17 | Immutable Collections | Thread-safe by design | Structural sharing |
🔧 JVM & Database (Parts 18-19)
| Part | Topic | Visualizer |
|---|---|---|
| 18 | Garbage Collection | Generational GC with object movement |
| 19 | SQL Joins | INNER, LEFT, RIGHT, FULL join matching |
🔬 Advanced Topics (Parts 20-24)
| Part | Topic | Key Feature | Visualizer |
|---|---|---|---|
| 20 | Bloom Filter | Probabilistic membership | Bit array with k hash functions |
| 21 | B-Tree | Database indexes | Node splits and merges |
| 22 | Consistent Hashing | Distributed systems | Hash ring with virtual nodes |
| 23 | Raft Consensus | Distributed consensus | Leader election and log replication |
| 24 | ArrayList vs LinkedList | Performance comparison | Side-by-side operation comparison |
🎮 How to Use the Visualizers
Each visualizer supports:
- ▶️ Play/Pause - Auto-advance through steps
- ⏮️ ⏭️ Step - Manual step forward/backward
- 🔄 Reset - Start over with new data
- ⚡ Speed - Adjust animation speed
- 📝 Code Panel - See pseudocode with active line highlighted
Keyboard Shortcuts
| Key | Action |
|---|---|
Space | Play/Pause |
→ | Step forward |
← | Step backward |
R | Reset |
? | Show help |
📊 Complexity Quick Reference
Time Complexity Comparison
O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ) Constant Binary Linear Merge Sort Bubble Recursive HashMap Search LinkedList Quick Sort Selection Fibonacci BST Heap Sort Insertion
Space Complexity
| Structure | Space |
|---|---|
| Array/ArrayList | O(n) |
| LinkedList | O(n) + pointer overhead |
| HashMap | O(n) + load factor overhead |
| BST/TreeSet | O(n) |
| Heap/PriorityQueue | O(n) |
🎯 Learning Paths
🚀 Interview Prep (1-2 hours)
Focus on most common interview topics:
- Part 1: ArrayList
- Part 3: HashMap
- Part 9: Binary Search
- Part 10: Sorting
- Part 11: Graph DFS/BFS
📚 Complete Foundation (4-5 hours)
Go through all parts in order for comprehensive understanding.
🔍 Topic Deep Dive
Jump directly to specific topics as needed:
- Need sorted data? → Part 4 (TreeSet)
- Priority processing? → Part 5 (PriorityQueue)
- Thread-safe maps? → Part 14 (ConcurrentHashMap)
- Producer-consumer? → Part 15 (BlockingQueue)
- Database indexes? → Part 21 (B-Tree)
- Distributed caching? → Part 22 (Consistent Hashing)
- Cluster consensus? → Part 23 (Raft)
- ArrayList or LinkedList? → Part 24 (Comparison)
✅ Summary & Key Takeaways
What This Series Offers
- Visual Learning - Every concept animated step-by-step
- Concise Format - Quick reference, not textbook chapters
- Practical Focus - Interview tips and real-world use cases
- Interactive - Learn by doing, not just reading
How to Get the Most Value
- Use visualizers actively - don't just watch, interact
- Try predicting the next step before advancing
- Review complexity tables before interviews
- Bookmark articles for quick reference
📚 Series Navigation
This series uses visualizers from @tomaszjarosz/react-visualizers