Two nodes of a BST were swapped by mistake. Recover the tree without changing its structure. Example: In , nodes 3 and 2 were swapped.
Correct tree is . The BST property is violated at two positions. You need to identify which two nodes were swapped and fix them.
Follow-up: Can you solve it using space (excluding recursion stack)? Constraints: up to nodes.