recover binary search tree 常数空间# JobHunting - 待字闺中
m*1
1 楼
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
如果中序遍历后存起来自然是好解决,可是不满足空间要求,如何在O(1)空间做到?
Recover the tree without changing its structure.
如果中序遍历后存起来自然是好解决,可是不满足空间要求,如何在O(1)空间做到?