■ Complete DSA Roadmap Cheat Sheet
1. Basic Structures
• Array → Fast access, but costly insert/delete (O(n))
• Linked List → Efficient insert/delete, slow search (O(n))
• Stack → LIFO operations, O(1) push/pop
• Queue → FIFO operations, O(1) enqueue/dequeue
• Deque → Double-ended queue, O(1) operations
2. Hashing
• HashMap / HashSet → Average O(1) lookup/insert/delete
• Good for fast searching but no order guarantee
3. Trees
• Binary Tree → Hierarchical structure
• Binary Search Tree (BST) → O(log n) search/insert (avg), O(n) worst
• Balanced Trees (AVL, Red-Black) → O(log n) guaranteed
• Heap (Min/Max) → Priority-based, O(log n) insert/extract
• Trie → Prefix search, O(L) where L=word length
4. Graphs
• Representations → Adjacency List (O(V+E)), Matrix (O(V^2))
• Traversal → BFS/DFS O(V+E)
• Shortest Path → Dijkstra O(E log V), Bellman-Ford O(VE)
• Minimum Spanning Tree → Kruskal/Prim O(E log V)
5. Algorithms
• Sorting → Merge Sort/Heap Sort O(n log n), Quick Sort O(n log n) avg, O(n^2) worst
• Searching → Linear Search O(n), Binary Search O(log n)
• Dynamic Programming → Optimization problems (O(n) – O(n^2))
• Greedy → Local optimal → global optimal (Huffman, MST)