Data Structures and Algorithms Lecture Notes
30 March 2011 • Heaps and Priority Queues
Sometimes it may be more convenient to store the root at index 1 and use index 0 to keep track of the number of nodes in the tree. In this case, the indexing is
Left child: 2
i
.
Right child: 2
i
+ 1.
This page last modified on 2006 January 24.