What should happen if a user attempts to pop an element from an empty stack?
What will be an ideal response?
Popping an element from an empty stack is most likely a logic error in the user code. The responsibility of
the stack data type is to let the user know that something isn’t right. The implementation of the stack data type should throw an
exception from within the pop operation if the stack is empty. The user’s program should detect and process the exception.
Computer Science & Information Technology