Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(1) (50%) Write a C program that takes as input a fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the expression into

image text in transcribed

image text in transcribed

(1) (50%) Write a C program that takes as input a fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the expression into a binary expression tree. Your program should take input from the command line. The entire expression should be in a character string without any space in it An input string only includes floating numbers in the format of Y.YY, that is, one digit to the left of the decimal point and two digits to the right of the decimal point, and variables of the form of xl, x2 Your program shall allow for the leaves in the expression tree not only to store floating values but also to store variables of the form xl, x2, x3, ..., which are initially 0.0 and can be updated interactively by the user. For example, expression ((rl +5.12) (r2 7.68))/r3) will be converted into a binary expression tree like: 5.12 x2 7.68 Your program should then show a menu with the following options 1. Display 2. Preorder 3. Inorder 4. Postorder 5. Update 6. Calculate 7. Exit Description: . When option 1 is selected, your program should display the tree in some way so that the tree can be visualized, and also print the name and value of each variable, like "x1:0.0" when x1 initially has value 0.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

Describe the two constraints on providing useful information.

Answered: 1 week ago