Showing posts with label iterative. Show all posts
Showing posts with label iterative. Show all posts

Wednesday, January 7, 2015

[LintCode]Search Range In Binary Search Tree

首先是brute-force的方法, inorder看是不是在range里,在的话就加入。时间复杂度是O(N)。显然面试官不可能希望这个方法。

[LintCode]Insert Node in Binary Search Tree

很简单题,每个node决定是往左还是往右还是就是这个节点。类似二分的做法。