Question discussion

The worst-case time complexity of Quick Sort is

1571Medium DSSSB TGT Computer Science 0 replies 1 views
0

The worst-case time complexity of Quick Sort is

  • AO(n)
  • BO(n log n)
  • CO(log n)
  • DO(n²)
Correct answer: D

Explanation

When the pivot is always the smallest or largest element (for example on an already sorted array with the first element as pivot), the partitions are unbalanced and the cost is O(n²).

Discussion 0

Nobody has replied yet. Start the discussion!