Expression Evaluation
Here are some questions that help you understand the stack data structure better.
- Can we also evaluate an infix expression by first converting it into a prefix expression, and then evaluating the prefix expression? Where are the operands for an operator in a prefix expression?
- In our example so far, we have implemented the stack as an array by restricting the access model to only one index. We will now study other possible implementations of a stack data structure.
- Study the queue data structure in the notes provided. Design an implementation scheme for a stack using only queue operations.
- Use a linked list to implement a stack. What are the advantages and disadvantages of this model.
- Another line of thought is to see how the stack data structure can be useful with small modifications. A peekStack is a data structure that allows one to peek at any element, but pop only the top element. Are there any applications of this facility?
- Think of your own modification to the stack along with a motivating application(s).