create the heap
root = n/2;
last = n;
while (root > 0)
{
shift(data,root,last);
root--;