0

Currently I stuck somewhere in a topic. I need an answer from selected options:

  1. When the partition that is picked is non-optimal.
  2. When the list is in completely random order.
  3. When the partition that is picked is in the middle of the list.
  4. When the list is completely backward.

Please assist me in this question. Thanks in advance.

timrau
  • 22,578
  • 4
  • 51
  • 64
  • Try to follow the steps of the algorithm by hand (e.g. on a shuffled suit of cards). What causes the partition step to be (almost) useless? – greybeard Jun 30 '15 at 17:04
  • Also see http://stackoverflow.com/questions/4708419/observing-quadratic-behavior-with-quicksort-on2 and http://stackoverflow.com/questions/4834740/quicksort-worst-case-condition – David K Jun 30 '15 at 17:05
  • The person asking the question is the one who needs assistance. There is no "the partition". Most implementations of quicksort will pick O (n) partitions during execution, so talking about "the partition" is nonsense. The answer: 1. Picking a non-optimal partition very often is a necessary but not sufficient condition. 4. If quick sort is implemented by a total idiot. – gnasher729 Jun 30 '15 at 17:10

0 Answers0