// supporting functions - for ordinary heaps void child (int i, int & lc, int & rc) // find the two children of i // return their positions in the two reference parameters { lc = 2 * i + 1; rc = 2 * i + 2; } int parent (int i) // return the position of the parent of i { return (i-1)/2; }