The inorder traversal list of the BST is given as follows:
a.txt, b.txt, c.txt, d.doc, e.html, f.c
Assume the program in f.c is compiled recently.
Perform splaying to move f.c to the root.
Answers
Answered by
2
Answer:
Given Inorder Traversal of a Special Binary Tree in which key of every node is greater than keys in left and right children, construct the Binary Tree and return root.
Examples:
Input: inorder[] = {5, 10, 40, 30, 28}
Output: root of following tree
40
/ \
10 30
/ \
5 28
Input: inorder[] = {1, 5, 10, 40, 30,
15, 28, 20}
Output: root of following tree
40
/ \
10 30
/ \
5 28
/ / \
1 15 20
Similar questions