Big O Notations - Sorting Algorithms Flashcards
Big O for Quicksort
Time
Best: Ω(n log(n))
Average: Θ(n log(n))
Worst: O(n^2)
Space
Worst: Θ(log(n))
Big O for Mergesort
Time
Best: Ω(n log(n))
Average: Θ(n log(n))
Worst: Θ(n log(n))
Space
Worst: O(n)
Big O for Timsort
Time
Best: Ω(n)
Average: Θ(n log(n))
Worst: 0(n log(n))
Space
Worst: O(n)
Big O for Heapsort
Time
Best: Ω(n log(n))
Average: Θ(n log(n))
Worst: O(n log(n))
Space
Worst: O(1)
Big O for Bubble Sort
Time
Best: Ω(n)
Average: O(n^2)
Worst: O(n^2)
Space
Worst: O(1)
Big O for Insertion Sort
Time
Best: Ω(n)
Average: O(n^2)
Worst: O(n^2)
Space
Worst: O(1)
Big O for Selection Sort
Time
Best: Ω(n^2)
Average: O(n^2)
Worst: O(n^2)
Space
Worst: O(1)
Big O for Tree Sort
Time
Best: Ω(n log(n))
Average: Θ(n log(n))
Worst: O(n^2)
Space
Worst: O(n)
Big O for Shell Sort
Time
Best: Ω(n log(n))
Average: Θ(n(log(n))^2
Worst: Θ(n(log(n))^2
Space
Worst: O(1)
Big O for Bucket Sort
Time
Best: Ω(n+k)
Average: O(nk)
Worst: O(n^2)
Space
Worst: O(n)
Big O for Radix Sort
Time
Best: Ω(nk)
Average: Θ(nk)
Worst: O(nk)
Space
Worst: O(n+k)
Big O for Counting Sort
Time
Best: Ω(n+k)
Average: Θ(n+k)
Worst: O(n+k)
Space
Worst: O(k)
Big O for Cubesort
Time
Best: Ω(n)
Average: Θ(n log(n))
Worst: Θ(n log(n))
Space
Worst: O(n)