Picking a Pivot

Using the median-of-three method , select a pivot to use to quicksort the following array:

A = [ 12 , 23 , 4 , 55 , 47 , 66 , 109 , 3 , 1 ] . A = [12,23,4,55,47,66,109,3,1].


The answer is 12.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Karleigh Moore
May 27, 2016

The first element is 12, the middle element is 47, and the last element is 1. The median of these three numbers is 12.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...