In this problem, we have given the root of a binary search tree (BST), where exactly two nodes of the tree were swapped by mistake. Write a code to recover binary search tree without changing its structure.
The solution using O(n) space is pretty straight forward. Can you solve this problem using constant space?