Question: include code that verifies that the BinarySearchTree meet these requirements: 1) The Binary Search Tree ADT is extended to include a boolean method similarTrees that

include code that verifies that the BinarySearchTree meet these requirements:

1) The Binary Search Tree ADT is extended to include a boolean method similarTrees that receives references to two binary trees and determines whether the shapes of the trees are the same. (The nodes do not have to contain the same values, but each node must have the same number of children.)

a) Write the declaration of the similarTrees method. Include adequate comments.

b) Write the body of the similarTrees method.

2) Extend the Binary Search Tree ADT to include a public method singleParentCount that returns the number of nodes in the tree that have only one child.

3) Extend the Binary Search Tree ADT to include a public method leafCount that returns the number of leaf nodes in the tree.

all I need is code to verify that these modifications would work. Thank you

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 Databases Questions!