You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
write a function compare(a, b) which compares the two trees defined by Nodes a and b and returns true if they are equal in structure and in value and false otherwise.
Examples:
1 1
| \ | \
2 3 2 3
=> true
1 1
| \ | \
3 3 2 3
=> false (values not the same 2 != 3)
1 1
| \ |
2 3 2
|
3
=> false (structure not the same)
*/
// Answer:
// return true if the binary trees rooted and a and b are equal in structure and value