What is true about Quicksort?

  • A: stable
  • B: always O(n log n)
  • C: on-line
  • D: in-place
  • E: best for small input

    Answer: D

    Quicksort is usually great. But it is not stable (it swaps items), can be O(n2) in the worst case, is not on-line (accepting a new item means sorting the whole set again), and is not that good for small input (recursive function calls are relatively expensive for the small cases). It is in-place, sorting within the original array.

    Contents    Page-10    Prev    Next    Page+10    Index