开发者

Is a Binary Search Tree inherited upward or inherited downward?

And why? I tried googling but it wouldn't come up with any answers.

I know that if the two nodes of the root are binary search trees, then the top one is a binary search tree. But does this mean that开发者_开发问答 it is inherited upward or inherited downward?

Thanks :)


If you were writing a function to check if a tree is a BST, then you would start at the top node, and recursively go down the child nodes checking if each one is a BST tree as well. On the other hand, you can also start at the bottom and work your way up inductively. Both solutions are ideal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜