Question: C++ code. Write a C++ function that returns True if two trees have the same values (they are made of nodes with the same values.)

C++ code.C++ code. Write a C++ function that returns True if two treeshave the same values (they are made of nodes with the samevalues.) It should return True ifthe trees have te same values or

Write a C++ function that returns True if two trees have the same values (they are made of nodes with the same values.) It should return True ifthe trees have te same values or False otherwise. The function takes four arguments: treenode of tree1, treenode of tree2, and two arrays. Note that two trees can have the same values but not have the same structure. To successfully code this function up you will have to populate two arrays in ascending order with the values you find when traversing the two trees. For example: if samevalueTree0 is called on the following two trees It should return True However, if samevalueTree0 is called on the following two trees: It should return False

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!