This post is completed by 1 user

  • 0
Add to List

60. Determine if Two BSTs are Identical

Objective: Given Two binary Search Trees, Check if both are identical.

Check if Two BST's are Identical


  • 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.