Stacks

Stacks and queues are both used to store data until it is ready to be used. A well known application of a stack is storing return addresses for procedures. This works effectively for nested procedures and for recursive calls.

Stacks are relatively easy to implement because (1) they have a constant start position, (2) they can only be added to and removed from one end and (3) they do not need to be sorted. Implementation using an array is efficient because the items do not change position or create gaps the way they do with deletions in a normal list.

Follow the numbered links to learn more.

Programming - a skill for life!

Introduction to lists (including arrays of records), linked lists, stacks and queues