Sorting Algorithms Worst Case Average Case Insertion Sort O (𝑛2 ) O (𝑛2 ) Best Case In Place Recursive Ω (n) Yes No INSERSION-SORT(A) Ω (nlog 𝑛) No Yes MERGE(A, p, q, r) MERGE-SORT(A, p, r) Yes Yes Yes Yes MAX-HEAPIFY – maintains - Ɵ (log 𝑛) BUILD-MAX-HEAP- Ɵ (n) HEAPSORT- Ɵ (nlog 𝑛) QUICKSORT(A, p, r) O (n log 𝑛) PARTITION(A, p, r) O (n) (tight code) Merge Sort O (nlog 𝑛) O (nlog 𝑛) Divide & concur (Memory usage grows with input size) Heapsort O (nlog 𝑛) Quicksort O (𝑛2 ) Divide & concur (tight code) O (n log 𝑛) if partitioned randomly Ω (nlog 𝑛)