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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started