Exercise 1.1.3

Select a data structure that you have seen previously, and discuss its strengths and limitations.

Stack

Strengths

  • Fast access of top element (constant time)
  • Push and pop operations are constant time
  • Best suited for recursive algorithms

Limitations

  • Fixed size - causes overflow if more than allocated elements are inserted
  • Only one element can be accessed at a time (i.e. top element)