Expression Evaluation

Here are some questions that help you understand the stack data structure better.

  1. 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?
  2. 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.
  3. Study the queue data structure in the notes provided. Design an implementation scheme for a stack using only queue operations.
  4. Use a linked list to implement a stack. What are the advantages and disadvantages of this model.
  5. 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?
  6. Think of your own modification to the stack along with a motivating application(s).