package net.datastructures; /** * An interface for a complete binary tree. A binary tree with height * h is complete if the levels 0,1,2,...,h - * 1 have the maximum number of nodes possible (that is, level * i has 2i nodes, for 0 <= i <= * h - 1) and in level h - 1 all the internal nodes * are to the left of the external nodes. * * @author Michael Goodrich */ //begin#fragment HeapTree public interface CompleteBinaryTree extends BinaryTree { //end#fragment HeapTree /** Adds an element to the tree just after the last node. Returns * the newly created position. */ //begin#fragment HeapTree public Position add(E elem); //end#fragment HeapTree /** Removes and returns the element stored in the last node of the * tree. */ //begin#fragment HeapTree public E remove(); } //end#fragment HeapTree