Which traversal algorithm can be used to determine if a given binary tree is a binary search tree (BST)?

  • Inorder traversal
  • Level order traversal
  • Postorder traversal
  • Preorder traversal
Inorder traversal can be used to determine if a given binary tree is a binary search tree (BST). In an inorder traversal of a BST, the elements are visited in non-decreasing order. Therefore, if the elements are visited in non-decreasing order during the inorder traversal, it indicates that the tree is a BST.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *