Leftist heap maintains a key and a rank for every node. The rank of a node is the number of nodes along in the shortest path to a leaf.
The whole tree needs two properties to be maintained:
- node.key < node.left.key && node.key < node.right.key
- node.left.rank >= node.right.rank
I can understand the first property as it is a heap and it is natural.
But what's the purpose of the 2nd property? Why we need to keep the right shorter than left?
For balancing purpose?