Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
Since a leftist heap is a heap-ordered binary tree, it inherits from the BinaryTree base class the three fields: key, left, and right. The key refers to the object contained in the given node and the left and right fields refer to the left and right subtrees of the given node, respectively. In addition, the field nullPathLength records the null path length of the given node. By recording the null path length in the node, it is possible to check the leftist heap balance condition in constant time.