Recover Binary Search Tree

来源:互联网 发布:相册动画制作软件 编辑:程序博客网 时间:2024/06/04 20:07

Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note: A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?
题意:
题目:恢复二叉排序数
二叉排序树中有两个节点被交换了,要求把树恢复成二叉排序树。
注意:你可以使用常量空间求解吗

0 0
原创粉丝点击