Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Programming Language Expert

The purpose of this assignment is to familiarize you with trees and traversals of trees, as well as to review stacks. In this assignment you will have to implement a program that reads a series of numbers and operations from a file using in-order traversal, build a tree from the file data, and evaluate the data in post-order by traversing the tree while modifying a stack.

Your stack must use a linked list to store the data – not an array.

Begin by defining your tree structure(s).

• Read in a mathematical equation from a file using pre-order traversal to build your tree.
• Use the @ symbol to denote a NULL as we have done in the code.
• When your tree is complete, initialize your stack as empty.
• Now perform a post-order traversal on your tree.
• If the node contains a number, push it onto your stack.
• If the node contains an operator (we’ll stick to just + - * / ), pop the top two numbers off your stack, perform said operation on them, and push the result back on your stack.
• When you finish traversing your tree, you should have the answer to your mathematical equation.

Make sure your code is humanly readable! Use meaningful variable names, clearly document the purpose of variables and code.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9395

Have any Question? 


Related Questions in Programming Language

Integrative programmingassignment- managing a user account

Integrative Programming Assignment- Managing a User Account List Objective: To manage a user list that can be modified and saved to a text file. Inputs: • Input text file consisting of pairs of usernames and passwords, s ...

Add a swift class file to the project that illustrates and

Add a SWIFT class file to the project that illustrates and contains the following: • The class name is 'Calculator' • Has public variables of the type float called numerator, denominator and total. • Has a method called ...

Write a program that calculates several possible tips to

Write a program that calculates several possible tips to give to a waiter at a restaurant. Ask the user to enter the total cost of the meal and then calculate a tip at 10%, 12.5%, 15%, 17.5%, and 20%. Write the original ...

Cp1404cp5632 2016 sp22252 assignment 1 - shopping list

CP1404/CP5632 2016 SP2/22/52 Assignment 1 - Shopping List 1.0 Task: You are to plan and then code a console-based program in Python 3, as described in the following information and sample output. This assignment will hel ...

You must do this assignment correctly as described

You must do this assignment correctly as described below.  If you do not follow the directions or break the rules you will receive a 0 score. Simulation of checking tic-tac-toe board for wins by counting X and O in rows, ...

Write a program to test for the case of a math equation

Write a program to test for the case of a math equation entered via the keyboard using the SWITCH-CASE operator. Types of equations to test for: x + y  x / y   x * y and x - y. The program is to ask for the following: 1. ...

Shell programmingyou have created the directory structure

Shell Programming You have created the directory structure and some base files to be used by the Web server and Web site. For the Web site to be created in a production environment, you need to package your commands in a ...

1 loops the greatest and the least- write a program with a

1. Loops: The greatest and the least- Write a program with a loop that lets the user to enter a series of integers. The use should enter -99 to signal the end of the series. After all the numbers have been entered, the p ...

1 implement dfs by using prolog2 implement bfs by using

1. Implement DFS by using PROLOG. 2. Implement BFS by using PROLOG. 3.  Solve the problem of Question 3 in Assignment 1 by using your PROLOG programs of DFS and BFS, respectively. Question 3 from Assignment 1 to Solve wi ...

Assignmentcase problem1 - online trivia found on pages

Assignment: Case Problem1 - Online Trivia found on pages 794-795 of your textbook. Complete the web pages and upload them to your 000WebHost account. After uploading the files make sure to update your index.html page to ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate