Lab #2 Due Oct. 4
Lab Objectives
· Demonstrate competence in working with stacks
Lab References
· Chapter 20: Stacks
Problem Description
In this problem we will deal with stacks and implementations thereof. There are 2 parts of this homework. In the present part I, you will work some problems with use of conceptual stacks. You will do this part on paper without programming. In part II you will write code to implement stacks.
Lab Exercise
1. Converting infix expressions to postfix expressions:
a. a / b + c - d * e + f - g + h
b. (a + b) * ((c + d) / (e - f)) + (g / h)
c. (a / (b + c) * d) / (e + (f * (g - h)))
2. Evaluating postfix expressions (a = 2, b = 3, c = 4, d = 5, e = 6, f = 7, g = 8, h = 9):
- ab*cd-/ef*g+-h+
- ab+c-d/e*fgh-*+
- ab+cd/ef+*gh-/-
|