Recover binary tree


whats wrong in this code

What i got from your code is that you thought that inorder traversal would give an ascending ordered list and you are checking for only adjacent elements. But you should keep in mind that it is not necessary that it is not necessary that adjacent elements are swapped. 3 1 2 4 … It can also be proved that 3 has been swapped either of them for example.
4
2 3
1 6 5 7
For this level ordered traversal . Try to check your code.

So think of some other logic.

@Madeshi-Chinmay-2159857244260221 can you please share the code i am unable to do it

You can take some hints from here.