Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure with constant space.
Example 1:
Input: [1,3,null,null,2]…
In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has no parents.
This paper was drafted in 2007, as a part of work in Web 2.0