How Test if a tree is a binary search tree en c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How Test if a tree is a binary search tree en c++

How can i Test if a tree is a binary search tree en c++

19th Dec 2022, 8:18 PM
A. A. Bensbihi
A. A. Bensbihi - avatar
1 Answer
0
One of the approach that I can think of is to use the fact that in-order traversal of a BST would always give a sorted list. So maybe just traverse the tree and see if the array you get is sorted or not
20th Dec 2022, 12:42 AM
Arsenic
Arsenic - avatar