Lab #3          Due Oct. 16

Lab Objectives

Demonstrate competence in working with stacks and using them in actual code

Lab References

Chapter 20: Stacks

Problem Description

This is part II of the assignment on stacks. In this part you will write code to implement stacks. Specifically, you must implement the algorithm for converting an infix expression into a postfix expression using a stack that is implemented as a linked list where the top of the stack is the first element in the list. Your program should take input either from the keyboard or from a file containing the expression. The program should output the expression in postfix notation. You should insert print statements in your program that would print a trace of the program operation. A method to traverse and print the list implementing the stack would be a good way to trace the stack contents.

Lab Exercise

Use the same infix expressions as those in part I to demonstrate and compare your programs performance.

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)))