问一道leetcode题:recover BST# JobHunting - 待字闺中
b*u
1 楼
http://oj.leetcode.com/problems/recover-binary-search-tree/
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
note说O(n) space straightforward,我怎么不觉得?要结构和原来一样,想不出O(n)
有什么明显解法。谁说说思路?
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
note说O(n) space straightforward,我怎么不觉得?要结构和原来一样,想不出O(n)
有什么明显解法。谁说说思路?