Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c) What is the output of the following program? (1 mark) #include #include #include myStack.h using namespace std; template void mystery (stackType & s, stackType
c) What is the output of the following program? (1 mark) #include #include #include "myStack.h" using namespace std; template void mystery (stackType& s, stackType: t) ; int main () { stackType s1; stackType s2; string list = {"Rain", "Thunderstorm", "Light Drizle", "Windy", "Dry Season", "Draught", "Flooding"} ; for (int i = 0; i void mystery (stackType& s, stackType > t) { while ( !s. isEmptyStack () ) { t. push (s. top () ) ; s . pop () ;QUESTION 3 (5 MARKS) a) Select whether the statement is True or False. i. A stack is a data structure in which the items can be added and deleted from both ends of the structure. (True / False) ii. The basic operations on a stack are as follows: Push an item onto the stack, pop an item from the stack, retrieve the top element of the stack, initialize the stack, check whether the stack is empty, and check whether the stack is full. (True / False) iii. The middle elements of a stack could be accessed directly. (True / False) iv. Postfix notation does not require the use of parentheses to enforce operator precedence, and the operators are written after the operands. (True / False) (2 marks) b) Convert the following infix expressions to postfix notations. i. (A + B) * (C + D) - E ii. A - (B + C) * D + E / F ili. ( (A + B) / (C - D) + E) * F - G iV. A + B * (C + D) - E / F * G + H
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