Question: 3. (4 points) A heap is a binary tree with a key at each of its nodes such that: It is essentially complete, i.e.,

 3. (4 points) A heap is a binary tree with a key  

3. (4 points) A heap is a binary tree with a key at each of its nodes such that: It is essentially complete, i.e., all its levels are full except possibly the last level. where only some rightmost keys may be missing as shown below The key at each node is greater than or equal to keys at its children. Add a boolen isHeap() method in the BST class in the book to whether the binary tree is a heap, then write a main() method with two examples, one is a heap and another is not, to demonstrate your method works correctly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!