O(n log n) is the lower bound because each of n elements must be compared at least log n times to ensure all permutations are considered
Image: The Government of the Grand-Duchy of Luxembourg, Public domain, via Wikimedia Commons
O(n log n) is the lower bound because each of n elements must be compared at least log n times to ensure all permutations are considered
merge sort: O(n log n) always
Merge sort consistently performs at O(n log n) time complexity for any input size
Binary search
Time complexity of binary search: O(log n) — halves search space each step
Best, worst and average case
Quicksort's average time complexity is O(n log n)
B-trees optimize: disk-based sorted data with O(log n) reads per query
B-trees optimize disk-based sorted data with O(log n) reads per query
Dijkstra's algorithm
Dijkstra's algorithm time complexity: O((V+E) log V)
Hash table
Hash table lookup: O(1) average time complexity
One email a day: 5 concepts + the 5 stories that matter →
Swipe through 100 ML concepts daily
Open TickerNews