Array Sorting Algorithms Time and Space Complexity Flashcards
What is the best, average, and worst time complexity for quicksort? What is the worst space complexity?
Best = Ω(n log n) Average = Θ(n log n) Worst = O(n^2) Space = O(log n)
What is the best, average, and worst time complexity for mergesort? What is the worst space complexity?
Best = Ω(n log n) Average = Θ(n log n) Worst = O(n log n) Space = O(n)
What is the best, average, and worst time complexity for timsort? What is the worst space complexity?
Best = Ω(n) Average = Θ(n log n) Worst = O(n log n) Space = O(n)
What is the best, average, and worst time complexity for heapsort? What is the worst space complexity?
Best = Ω(n log n) Average = Θ(n log n) Worst = O(n log n) Space = O(1)
What is the best, average, and worst time complexity for bubble sort? What is the worst space complexity?
Best = Ω(n) Average = Θ(n^2) Worst = O(n^2) Space = O(1)
What is the best, average, and worst time complexity for insertion sort? What is the worst space complexity?
Best = Ω(n) Average = Θ(n^2) Worst = O(n^2) Space = O(1)
What is the best, average, and worst time complexity for selection sort? What is the worst space complexity?
Best = Ω(n^2) Average = Θ(n^2) Worst = O(n^2) Space = O(1)
What is the best, average, and worst time complexity for tree sort? What is the worst space complexity?
Best = Ω(n log n) Average = Θ(n log n) Worst = O(n^2) Space = O(n)
What is the best, average, and worst time complexity for shell sort? What is the worst space complexity?
Best = Ω(n log n) Average = Θ(n (log n)^2) Worst = O(n (log n)^2) Space = O(1)
What is the best, average, and worst time complexity for bucket sort? What is the worst space complexity?
Best = Ω(n + k) Average = Θ(n + k) Worst = O(n^2) Space = O(n)
What is the best, average, and worst time complexity for radix sort? What is the worst space complexity?
Best = Ω(nk) Average = Θ(nk) Worst = O(n^2) Space = O(n)
What is the best, average, and worst time complexity for counting sort? What is the worst space complexity?
Best = Ω(n + k) Average = Θ(n + k) Worst = O(n + k) Space = O(k)
What is the best, average, and worst time complexity for cubesort? What is the worst space complexity?
Best = Ω(n) Average = Θ(n log n) Worst = O(n log n) Space = O(n)