solulubeta
Sign in
Cheat Sheets / Coding
02.01 · Cheat sheet

DSA Patterns

What fits in the time limit, the cost of every common data structure and sort, a clue-to-pattern table, and the templates for binary search, sliding window, graphs and trees.

3 min Cheat sheet Pro

Read the constraints, spot the pattern, pick the data structure.

What fits in 1 second

Java does about 10⁸ simple steps per second.

n up toTarget
10O(n!)
20O(2ⁿ)
500O(n³)
5,000O(n²)
10⁶O(n log n)
10⁸O(n)

Data structure costs

StructureMain operations
Arrayget O(1), search O(n), insert in the middle O(n)
HashMap / HashSetget, put O(1) on average
TreeMap / TreeSetget, put, floor, ceiling O(log n)
Heap (PriorityQueue)peek O(1), push and pop O(log n)
Stack / Queuepush, pop O(1)
Linked listinsert at a known node O(1), search O(n)
solulu Pro

Continue this cheat sheet with Pro

Inside: 8 sections.

  • What fits in 1 second
  • Data structure costs
  • Sorting
  • Clue → pattern
  • Binary search
  • Sliding window
  • +2 more
Lifetime ₹1,999 ₹999 · Launch offer
Mark this as done when you are finished.

Item 5 of 12 · updated 2026-10-13