m*****e 发帖数: 47 | 1 If an inorder traversal on a binary tree gets the elements in sorted order,
does it necessarily prove it is a binary search tree? | g*********s 发帖数: 1782 | 2 a bt is bst iff inorder travesal returns a strictly sorted array.
notice there's trap: if the bt has duplicate elements, it can't be a bst.
but if excluding duplicates, u can use mathematical induction to prove it.
order,
【在 m*****e 的大作中提到】 : If an inorder traversal on a binary tree gets the elements in sorted order, : does it necessarily prove it is a binary search tree?
| m*****e 发帖数: 47 | 3 That's also what I think. Thanks for confirming it. |
|