Median and Selection
 








 

INPUT                                  OUTPUT

Input Description: A set of n numbers or keys.



Problem: Find the item which is smaller than half of the items and bigger than half the items.



Median finding is a special case of the more general selection problem, which asks for the $i$th element in sorted order.

(c) Shilpa Sayura Foundation 2006-2017