← Back

Searching

Algorithms for finding elements in data structures

Linear Search

Best:O(1)Avg:O(n)Space:O(1)
simpleunsorted

Binary Search

Best:O(1)Avg:O(log n)Space:O(1)
sorteddivide-and-conquerefficient

Breadth-First Search

Best:O(V+E)Avg:O(V+E)Space:O(V)
graphlevel-ordershortest-path

Depth-First Search

Best:O(V+E)Avg:O(V+E)Space:O(V)
graphrecursivebacktracking