# Quicksort median

• 05-16-2012, 12:25 PM
louboulos
Quicksort median
Hello. I have an excercise that asks the following:
Consider a modification to QuickSort, such that each time "Partition" is called, the median of the portioned array is found and used as a pivot. Write a pseudocode fo that.

I'm not asking for the answer. I just want to know what the median is. Is it the number that splits the array in half?
i.e: In case of (1,2,3,4,5,6,7,8,9) the median is 5?
Thank you.
• 05-16-2012, 12:37 PM
JosAH
Re: Quicksort median

kind regards,

Jos
• 05-16-2012, 05:41 PM
louboulos
Re: Quicksort median
can someone else explain please what does the exercise want?
• 05-16-2012, 05:47 PM
JosAH
Re: Quicksort median
Quote:

Originally Posted by louboulos
can someone else explain please what does the exercise want?

kind regards,

Jos
• 05-16-2012, 07:10 PM
louboulos
Re: Quicksort median
yeah but I dont get much... :)
• 05-16-2012, 08:28 PM
JosAH
Re: Quicksort median
Quote:

Originally Posted by louboulos
yeah but I dont get much... :)

Don't just skim over it but study the material; there's even very clear pseudo code in there. We are not going to spoonfeed you ...

kind regards,

Jos
• 05-16-2012, 10:36 PM
pbrockway2
Re: Quicksort median
Quote:

I just want to know what the median is. Is it the number that splits the array in half?
Yes, more or less. For the precise definition read the "median" link in the second sentence of the Wikipedia article you have already been pointed at.