Two elements of a binary search tree (BST) are swapped by mistake.

Recover the tree without changing its structure.

I saw most of the algorithm find the two nodes first, then change their value;

The problem is that "Two elements of a binary search tree" should mean that the two nodes are swapped by mistake. We need to swap the two nodes, not just the value.

In practice, the tree nodes may contain other information and swapping only the values will make another mistake, instead of fixing it.