This preview shows page 1. Sign up to view the full content.
Unformatted text preview: void printRange(BinNode<Elem>* root, int low, int high) { if (root == NULL) return; if (KEComp.lt(high, root>val()) // all to left printRange(root>left(), low, high); else if (KEComp.gt(low, root>val())) // all to right printRange(root>right(), low, high); else { // Must process both children printRange(root>left(), low, high); PRINT(root>value()); printRange(root>right(), low, high); } } 5.15 The minimum number of elements is contained in the heap with a single node at depth h − 1 , for a total of 2 h − 1 nodes. The maximum number of elements is contained in the heap that has completely f lled up level h − 1 , for a total of 2 h − 1 nodes. 5.16 The largest element could be at any leaf node. 5.17 The corresponding array will be in the following order (equivalent to level order for the heap): 12 9 10 5 4 1 8 7 3 2...
View
Full
Document
This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.
 Fall '08
 BELL,D

Click to edit the document details