Home › Algorithms

Algorithms & Data Structures

Master sorting, searching, linked lists, and complexity analysis — with clean Java implementations for interviews and production.

Advertisement

Complexity Cheat Sheet

Quick reference for common algorithm time & space complexities

AlgorithmBestAverageWorstSpace
Binary SearchO(1)O(log n)O(log n)O(1)
Linear SearchO(1)O(n)O(n)O(1)
Merge SortO(n log n)O(n log n)O(n log n)O(n)
Quick SortO(n log n)O(n log n)O(n²)O(log n)
Bubble SortO(n)O(n²)O(n²)O(1)
Insertion SortO(n)O(n²)O(n²)O(1)
HashMap LookupO(1)O(1)O(n)O(n)
TreeMap LookupO(log n)O(log n)O(log n)O(n)

Ready to Crack Algorithm Interviews?

All posts are free. No login required.

Browse Algorithm Posts →