Question: A stack is a data structure which is used to store data in a particular order. (a) List THREE (3) applications which implement stack concept.

A stack is a data structure which is used to store data in a particular order.

(a) List THREE (3) applications which implement stack concept.

(b) Assume that a stack contains a list of staff ID (staff_id) and it is implemented using linked list.

i. Write the C++ code to add new staff ID into the stack.

ii. Write the C++ code to remove the most recent staff ID added into the stack.

(c) One of the applications that apply stack concept is to compute arithmetic expression. Use the postfix evaluation algorithm to evaluate the following postfix expression. Show the content of the stack each time you scan a new token from the expression:

3, 9, 4, -, +, 2, 10, 2, -, 4, /, *, -

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!