When a stack is implemented using a 1-D array, adding a valid item can cause an execution error. Explain why an execution error can occur in this situation.

The key thing to remember here is that an array is a fixed size data structure so any attempt to exceed this size will cause an error during execution e.g. trying to add an item to an already full stack will cause a 'stack full (overflow)' error. Like only being able to add water to a bottle before it eventually overflows.

TT

Related Computing A Level answers

All answers ▸

Explain how a stack could be used in the process of evaluating an expression in Reverse Polish notation.


Write pseudocode for the linear search algorithm, and then explain it’s complexity using big-O notation


What is the main difference between the Stack and the Queue abstract data types?


What is recursion and why is it useful?