Track Array Median

/**
 * TrackArrayMedian.java
 * 
 * Description: Numbers are randomly generated and stored into an
(expanding)
 * array. How would you keep track of the median?
 * 
 * A heap is really good at basic ordering and keeping track of max and
mins.
 * This is actually interesting - if you had two heaps, you could keep
track of
 * the biggest half and the smallest half of the elements. The biggest
half is
 * kept in a min heap, such that the smallest element in the biggest
half is at
 * the root. The smallest half is kept in a max heap, such that the
biggest
 * element of the smallest half is at the root. Now, with these data
structures,
 * you have the median elements at the roots. If the heaps are no longer
the
 * same size, you can quickly "rebalance" the heaps by popping an
element off
 * the one heap and pushing it onto the other.
 * 
 * @author John Qiao <qiaoshun8888@gmail.com> Date: Jan 25, 2014
 */