Question: Given the following: public void perfectify ( ) { / / TODO: Assignment Part 3 } Converts the binary tree into a perfect tree by

Given the following:
public void perfectify(){
//TODO: Assignment Part 3
}
Converts the binary tree into a perfect tree by adding nodes with the value -1.
* A perfect binary tree is one where all leaves are at the same level and every branch node has two children.
* Another way of thinking of it is that you are adding dummy nodes to the tree until every path from the root to a leaf is the same length. You may need to create a perfectify helper method for this recursive method. Thanks.

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!