Ask Question, Ask an Expert


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

Business app programmingwrite the following programwrite a

Business App Programming Write the following Program: Write a Java program to the form below. The program must work with decimal numbers and each button must work correctly. The result must be done in a popup window. The ...

Programming assignmentdescription your algorithm first

Programming Assignment Description: Your algorithm first takes an input size (N) from the user and generates a random sequence of N integers ranging from -99999 to 99999. If N is less than 50, your program must print the ...

Write a program which1 asks the user to enter a positive

Write a program which: 1. Asks the user to enter a positive integer greater than or equal to 0 2. Validates that the entry is a positive integer 3. Outputs the digits in reverse order with a space separating the digits 4 ...

Question 1 batteriesi want to use a galvanic cell to power

Question 1: Batteries I want to use a galvanic cell to power a 60-watt light bulb. Complete the following steps to determine how long the galvanic cell will power the light bulb before running out. a.) The galvanic cell ...

Assignmentwrite a program to converts temperatures between

Assignment Write a program to converts temperatures between Fahrenheit and Celsius. Your program should print a brief message describing what it does, and then prompt the user to enter "1" if they would like to convert a ...

In this assignment you will write r functions for

In this assignment, you will write R functions for forecasting future values of a time series, and apply them to observations on numbers of deaths and maximum temperatures in Houston, Texas. Doing this will provide more ...

Lab- forms loops and stringssubmission Lab- Forms, Loops and Strings Submission

Lab- Forms, Loops and Strings Submission Instructions How Please submit your lab report to the Lab4_Submission folder in Moodle. When Labs are due in 1 week on Feb. 13, 2014 Exercises: Goals: - Gain more hands-on with us ...

Program assignment multi-threaded programming in java

Program Assignment: Multi-threaded Programming in Java Using Locks Objectives: To practice programming cooperating, synchronized multiple threads of execution. Description: In this programming assignment you will simulat ...

Assignment- object oriented programmingthis program will

Assignment- Object Oriented Programming This program will use 2 different data structures to perform the same tasks; a vector and a dynamically sized array Write a complete C++ program that will: Declare a vector of inte ...

Write a program where you create a class called bankaccount

Write a program where you create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two const ...

  • 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

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen