Tag Archives: correct a BSTwith 2 interchanged elements

Fix binary search tree with 2 swapped nodes

Fix binary search tree with 2 swapped nodes Problem statement to fix binary search tree (BST) with two swapped nodes. We are given a binary search tree (BST) where exactly two nodes are swapped. The aim is to output the corrected BST. Example for a binary search  tree where two nodes are interchanged: Input: 7… Read More »