Submissions : 2188 Accuracy :


Make Binary Tree (Function Program)

Given Linked List Representation of Complete Binary Tree, construct the Binary tree.Your task is to complete the function convert which takes two arguments the first being the head denoting the head of the linked list and the second argument is root denoting the root of the tree to be constructed.

Note : The complete binary tree is represented as an linked list in a way where If root node is stored at position i, its left, and right children are stored at position 2*i+1, 2*i+2 respectively.





The first line of input is the no of test cases T. Then T test cases follow . Each test case contains 2 lines. The first line contains an integer N denoting the no of nodes of the linked list . Then in the next line are N space separated Ki values of the linked list .

Output of each test case will be the level order traversal of the the constructed binary tree. You do not have to  print it .

1<=Ki <=1000

Example(To be used only for expected output ) :

1 2 3 4 5

1 2 3 4 5

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

**For More Examples Use Expected Output**

It is recommended to test your code before clicking 'Submit' button!


Need help with your code? Please use, generate link and share the link here.