operator to actually divide by when is less than you're done the sequence of remainderswhich you can save in an array or stringis the binary number (the least significant bits correspond to the lower end of the path here' how you might calculate itwhile( > path[ ++ you could also use recursive approach in which the remainders are calculated each time the function calls itself and the appropriate direction is taken each time it returns after the appropriate node (or null childis foundthe heap operations are fairly straightforward when trickling up or downthe structure of the tree doesn' changeso you don' need to move the actual nodes around you can simply copy the data from one node to the next this wayyou don' need to connect and disconnect all the children and parents for simple move the node class will need field for the parent node because you'll need to access the parent when you trickle up we'll leave the implementation of the tree heap as programming project the tree heap operates in (logntime as in the array-based heap the time is mostly spent doing the trickle-up and trickle-down operationswhich take time proportional to the height of the tree heapsort the efficiency of the heap data structure lends itself to surprisingly simple and very efficient sorting algorithm called heapsort the basic idea is to insert all the unordered items into heap using the normal insert(routine repeated application of the remove(routine will then remove the items in sorted order here' how that might lookfor( = <sizej++theheap insertanarray[ )for( = <sizej++anarray[jtheheap remove()/from unsorted array /to sorted array because insert(and remove(operate in (logntimeand each must be applied timesthe entire sort requires ( *logntimewhich is the same as quicksort howeverit' not quite as fast as quicksortpartly because there are more operations in the inner while loop in trickledown(than in the inner loop in quicksort