In the context of memory allocation within a program, what type of stack is used?
Linked List
Queue
Heap
Call Stack
What is the time complexity of pushing an element onto a stack implemented using a linked list, assuming the push operation is implemented efficiently?
O(log n)
O(n log n)
O(1)
O(n)
What happens when you try to 'pop' an element from an empty stack?
A random element from the stack is removed.
It depends on the specific implementation of the stack.
The program crashes.
A special value (like -1) is returned.
How does a stack help in converting infix expressions to postfix?
By eliminating the need for parentheses
By directly translating the expression
By prioritizing operators based on precedence
By reversing the order of operands
Which of these is NOT a typical application of stacks?
Storing data in a priority-based order
Undo/Redo functionality in text editors
Evaluating mathematical expressions (postfix notation)
Managing function calls in a program's execution
How does a stack implemented using a linked list handle overflow compared to an array-based implementation?
Linked list implementation also suffers from overflow.
Both implementations handle overflow similarly.
Linked list implementation prevents overflow by overwriting existing elements.
Linked list implementation avoids overflow as long as memory is available.
In the context of the 'Next Greater Element' problem, what does the term 'next greater' refer to?
The element that appears most frequently after the current element.
The element that is both to the right and has a larger value.
The element with the next highest value in a sorted order.
The element that is lexicographically greater.
In depth-first search (DFS) algorithms, what role does the stack play?
Storing visited nodes
Calculating shortest paths
Maintaining the order of node exploration
Storing edge weights
What is the primary disadvantage of using stacks compared to other data structures?
High memory consumption
Slow insertion and deletion at the end
Inability to store duplicate elements
Limited access to elements (only top)
If you implement a stack using an array, what problem might you encounter if you keep pushing elements onto the stack without any limit?
Stack Overflow
Memory Leak
Segmentation Fault
None of the above