HW04 Evaluating a postfix expression Full Credit 10 pts Due 1022 .docx

This preview shows page 1 - 3 out of 4 pages.

Image of page 1

Subscribe to view the full document.

HW04: Evaluating a postfix expression Full Credit: 10 pts Due: 10/22 This homework consists of two parts. The first part you'll need to define and implement a stack of type T. Your stack will be implemented by using a dynamic array (similar to the ArrayStack introduced in the lecture, but the underlying array is in free store), called it dynAnStack. Here is the definition of the stack. You'll have to implement all methods that are not implemented yet. template-class T> class dynArtStack static const int deCap - 30; int top: Titems; /array in the dynamic memory storage publie: dynArtStack(): top(-1) items-new T[deCap); } dynAnStackconst dynAnStack<T>& rhs ): -dynArtStack({delete items, top = -1; } dynArr Stack<T>& operator (const dynArtStack<T>&rhs); bool isEmpty(const; bool push( const T& nEntry); bool pop(); T peek() const; int size) const { return top + 1; } The second part: The postfix notation is used to represent algebraic expressions. The expressions written in postfix form are evaluated faster compared to infix notation as parenthesis are not required in postfix. Given an
Image of page 2
Image of page 3
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes