LEARNIQ BRAND SYSTEM
The Complete
DSA Cheatsheet
Data Structures & Algorithms for Exams, Coding Interviews & Placements
INCLUDED CONTENT
Topics Covered • Python + Java Code • Time Complexity Charts
Beginner → Advanced High-Yield Concepts Interview Frameworks
Full Study Path No Textbook Fluff Targeted Revision
Created by LearnIQ • © 2026
, LearnIQ | DSA Cheatsheet Beginner → Advanced
Table of Contents
1. Big-O / Time Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 2
2. Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 3
3. Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 4
4. Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 5
5. Stacks & Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 6
6. Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 7
7. Heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 8
8. Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 9
9. Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 10
10. Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 11
11. Recursion & Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 12
12. Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 13
13. Interview Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 14
14. Quick Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 15
15. Interview Prep Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 16
LearnIQ — DSA Cheatsheet Page 1
, LearnIQ | DSA Cheatsheet Beginner → Advanced
1 01. Big-O / Time Complexity
1.1 The Complexity Spectrum
Big-O notation represents the upper bound execution limit of an algorithm relative to the size of input n. Use the
following reference analogies to build quick analytical intuition:
O(1) (Constant Time): Instant lookup. Finding an element by index in an array. Analogy: Grabbing the book
right in front of you.
O(log n) (Logarithmic Time): Splitting the search space in half each step. Binary Search. Analogy: Looking up
a word in an alphabetized physical dictionary.
O(n) (Linear Time): Checking every element once. Simple search. Analogy: Checking every book on a shelf
sequentially.
O(n log n) (Linearithmic Time): Divide-and-conquer sorting. Merge Sort, Quick Sort. Analogy: Sorting small
stacks of paper and merging them orderly.
O(n2 ) (Quadratic Time): Comparing all pairs. Nested loops. Bubble Sort. Analogy: Comparing every book on a
shelf to every other book on the shelf.
O(2n ) (Exponential Time): Trying every combination recursively. Pure Fibonacci calculation. Analogy: Unlocking
a combination lock by guessing every possible code.
1.2 Comparison and Mathematical Limits
O(1) < O(log n) < O(n) < O(n log n) < O(n2 ) < O(2n ) < O(n!)
Complexity Class Name N = 10 Operations N = 1000 Operations
O(1) Constant 1 1
O(log n) Logarithmic ≈3 ≈ 10
O(n) Linear 10 1,000
O(n log n) Linearithmic ≈ 33 ≈ 10, 000
O(n2 ) Quadratic 100 1,000,000
O(2n ) Exponential 1,024 ≈ 1.07 × 10301 (Infeasible)
Table 1: Time Complexity Operation Growth Rate Table
1.3 Visual Complexity Growth Map
Operations (N ) O(n log n)
O(n)
O(n2 )
O(log n)
O(1)
Input Size (n)
LearnIQ — DSA Cheatsheet Page 2