技术随感
2011年2月28日星期一
Check if a binary tree is BST or not 检查一个二叉树是不是二叉搜索书
Best Solution:
1) Do In-Order Traversal of the given tree and store the result in a temp array.
3) Check if the temp array is sorted in ascending order, if it is, then the tree is BST.
Time Complexity: O(n)
Auxiliary Space: O(n)
没有评论:
发表评论
‹
›
主页
查看网络版本
没有评论:
发表评论