Construct Binary Tree From Inorder And Levelorder Traversal
1. You are given a partially written function to solve(Refer question video).Input Format
2. Task : Construct Binary Tree from InOrder and LevelOrder Traversal.
3. you will be given two arrays representing a valid InOrder & LevelOrder of a Binary Tree. Program is required to create a unique Binary Tree.
Input is managed for you.Output Format
Output is managed for you.Question Video
0 <= Number of Nodes <= 10^9Sample Input
-10^9 <= value of Node data <= 10^9
Valid InOrder and LevelOrder traversals.
9Sample Output
2 7 15 12 6 9 5 11 4
12 7 5 6 11 2 15 4 9
7 -> 12 <- 5
2 -> 7 <- 15
. -> 2 <- .
. -> 15 <- .
6 -> 5 <- 11
. -> 6 <- 9
. -> 9 <- .
. -> 11 <- 4
. -> 4 <- .
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run