a) 1
b) 2
c) 3
d) 4
Answer: b
Explanation: The addFront and removeFront operations can be performed using one stack itself as push and pop are supported (adding and removing element from top of the stack) but to perform addRear and removeRear you need to pop each element from the current stack and push it into another stack, push or pop the element as per the asked operation from this stack and in the end pop elements from this stack to the first stack.
Related Posts
What is the result of the given postfix expression? abc*+ where a=1, b=2, c=3.
Which of the following statement is incorrect?
While evaluating a postfix expression, when an operator is encountered, what is the correct operation to be performed?
Which of the following is not an application of stack?
Which of these operators have the highest order of precedence?
In Postfix expressions, the operators come after the operands.
What is the time complexity of evaluation of postfix expression algorithm?
Join The Discussion