Skip to content Skip to sidebar Skip to footer

Best Case Quicksort

The worst case time complexity of a typical implementation of QuickSort is O(n2). The worst case occurs when the picked pivot is always an extreme (smallest or largest) element. This happens when input array is sorted or reverse sorted and either first or last element is picked as pivot.

Which scenario quick sort gives best case complexity?

Quick Sort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array. If pivot element divides the array into two equal half in such a scenario, quick sort takes the least time sort, that is, best case time complexity.

Post a Comment for "Best Case Quicksort"