During the infix to postfix conversion of the expression 'A+B*C-D/E', which operator would be pushed onto the stack first?
/
Which of the following stack operations has a time complexity of O(1) in both array-based and linked list-based implementations?
All of the above
Pop
Peek
Push
What is the result of evaluating the prefix expression '-+5*234'?
7
-17
-7
17
What is the time complexity of the 'peek' operation in a well-implemented stack?
O(log n)
O(n log n)
O(1)
O(n)
If you represent an arithmetic expression in postfix notation using a stack, what operation would you perform when encountering an operand (a number)?
Check if the stack is empty.
Push the operand onto the stack.
Ignore the operand.
Pop the top two elements from the stack, perform the operation, and push the result back onto the stack.
How do stacks facilitate backtracking in algorithms?
By maintaining a record of visited states and enabling the algorithm to revert to previous states.
By optimizing the search space for the algorithm.
By storing the optimal solution found so far.
By providing a mechanism for parallel processing.
Imagine a stack is used to track function calls in a recursive program. What happens to the stack when a function returns?
The entire stack is cleared.
The corresponding function call is pushed onto the stack.
The corresponding function call is popped from the stack.
The stack remains unchanged.
Which real-life scenario most accurately reflects the LIFO (Last In First Out) principle of a stack data structure?
A list of tasks sorted by priority.
A tree of files and folders on a computer.
A stack of plates on a table.
A queue of people waiting for a bus.
What is the primary disadvantage of implementing a stack using a fixed-size array?
Higher memory usage compared to dynamic arrays
Complex implementation requiring advanced pointer manipulation
Increased time complexity for push and pop operations
Inability to handle stacks larger than the predetermined size
Which of the following operations is NOT typically associated with a Deque?
pop (remove from the rear)
push (insert at the rear)
peek (view the element at the front without removing)
inject (insert at the front)