This post is completed by 1 user
|
Add to List |
60. Determine if Two BSTs are Identical
Objective: Given Two binary Search Trees, Check if both are identical.
Approach:
- Traverse both trees at the same time, starting from the root.
- Check if roots are not null and data are matched, if not, return false.
- Make recursive calls to root.left and root.right.
- If any of the trees get over and the other tree is not, return false.
- if both traversals of both trees end at the same time, return true
- see code.
true false