Note
Big-O for everyday data structures
Sunil Tiwari· Oct 12, 2026 · 1 min
Inline math and code mixed into plain text — e.g. a hash map lookup is on average and you call it with map.get(key).
Arrays and lists
- Index access
a[i]: - Search unsorted: · search sorted (binary search):
- Insert at end (dynamic array): amortised · insert at front:
Hash maps
- Get / put / delete: average, worst case when everything collides.
Trees and heaps
- Balanced BST search / insert / delete:
- Heap push / pop: · peek:
Sorting
- Merge sort, heap sort: always.
- Quick sort: average, worst.
- Counting sort: when keys are small integers.
Growth at a glance
For : , , — the difference between milliseconds and days.
Was this useful?
Written bySunil Tiwari
Notes and canvases, together.This page was made with Octonote AI. Publish your own in one click.
Get started free