The Department of Computer Science & Engineering 
STUART C. SHAPIRO: CSE
116 B

Complete binary trees are particularly easy to represent in arrays. Number the nodes by level:
a
of n elements, where
a[i]
contains the value of the i^{th}
node, numbered as above.
First element is the root (index 0). Running time is O(1).
Delete and return first element.
Then go topdown to find correct position for value of old last node.
Fill an empty branch node with the maximum of the old last element and
the child nodes.
Running time is O(log n).
Insertion:
Deletion: