problem statement -pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

problem statement -pls help

You are given a level order traversal of a Binary Tree. The binary tree has exactly two node values that were swapped by mistake, recover the tree without changing the structure, to make it a Binary Search Tree. Print the vertical order of the BST. Example 1- Step 1: Input is given in a level order like below 3,1,4,null,null,2 which represents this tree, read it from the file and construct a binary tree Step 2: But this binary tree has two nodes that have swapped values, 3 and 2. Once we swap it, we will have a Binary Search Tree. Step 3. Once we have the tree in the correct order, get the vertical order of the binary search tree and print it from left to right (ie the nodes on the left most vertical column will be printed first) and top to down (ie nodes in the same vertical column should be printed from top to down). Output 1,2,3,4

16th Sep 2023, 8:23 AM
Mahesh Pradhan
Mahesh Pradhan - avatar
2 Answers
+ 5
Mahesh Pradhan , to get help, we need to see your code attempt. > please do a try by yourself first, save it in playground, create a link to this code and post it here.
16th Sep 2023, 10:48 AM
Lothar
Lothar - avatar
+ 4
Learn => Practice => Solve. This is the way of solving any problem. You will not get direct codes everywhere. Sometimes you have to do it by yourself. If you have any doubts you can ask in the community.
16th Sep 2023, 8:32 AM
JAY
JAY - avatar