Question: Write a C program to construct a binary search tree (BST) using the given inorder and postorder traversals. The tree is accessed using a pointer
Write a C program to construct a binary search tree (BST) using the given inorder and
postorder traversals. The tree is accessed using a pointer pointing at root. Display a menu for
the user to provide input, and call appropriate function with inputs provided. Assume that all
the values in the BST are distinct and positive.
• On menu input 1, call a function to receive inorder and postorder traversals of the BST
from user and construct it. Display the number of leaves, the number of levels, and the
number of nodes in each level.
• On menu input 2, call a function to delete a node from the BST and display the preorder
traversal of the tree. (Non-recursive code. No marks for the recursive version.) The node
value will be input by the user. (If there is no node with such a value then print ‘error’.
If tree is empty, display ‘empty’.) Only one node at a time will be asked for deletion.
Step by Step Solution
3.33 Rating (153 Votes )
There are 3 Steps involved in it
Heres a C program which constructs a Binary Search Tree BST using the given inorder and postorder tr... View full answer
Get step-by-step solutions from verified subject matter experts
