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.


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
Get step-by-step solutions from verified subject matter experts
