This post is completed by 1 user
|Add to List|
Check if Two BST's are Identical
Objective: Given Two binary Search Trees, Check if both are identical.
Input: Two binary Search Trees
- 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 gets over and other is not, return false.
- if both traversals of both trees end at the same time, return true
- see code.
- Find all possible combinations with sum K from a given number N(1 to N) with the repetition of numbers is allowed Medium