What is the worst-case time complexity of quicksort?

  • A O(n log n)
  • B O(n)
  • C O(n^2)
  • D O(log n)

Explanation

When the pivot is always the smallest or largest element, for example on an already sorted array with a poor pivot choice, quicksort degrades to O(n^2).