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.
Loading...
Related Quiz
- Which layer of the OSI model is responsible for routing packets between different networks?
- How does sharding contribute to scalability in NoSQL databases?
- How does denormalization differ from normalization, and when is it appropriate to use?
- Which ACID property ensures that transactions maintain consistency in the database?
- In dynamic programming, the ___________ technique is used to store previously computed results...