Write a C program that takes as input a fully parenthesized, arithmetic expression and converts it to a binary expression tree. Your program shall allow for the leaves not only to store floating values but also to store variables of the form x1, x2, x3, and so on, which are initially 0.0 and which can be updated interactively by the user. For example, expression ((x1 + 5.12) * (x2 - 7.68)) will be converted into a binary expression tree as follows:
Your program should then show a menu with the following options:
Description:
Ø When option 1 is selected, your program should display the tree in some way (easy to recognize a binary tree) and also print the name/value of variables (if any).
Ø If an option from 2, 3 or 4 is selected, your program should print out the expression by the corresponding traversal order (Note: no parentheses for preorder and postorder traversal but fully parenthesized for inorder traversal).
Ø Option 5 requires further input from user. A pair of input, namely,
variable_name, new_value
will be provided interactively and your program should search for variable_name and replace its value by new_value.
Ø Arithmetic calculation is invoked by option 6 which shall display the result.
Ø Option 7 terminates your program.