 the algorithm is done in-place).The implementation is also useful for use as a Priority queue where use of a dynamic array allows insertion of an unbounded number of items.The upheap/downheap operations can then be stated in terms of an array as follows