Heap utilitzing median funciton