Introduction to Stacks

A stack is a collection of items that can only be stored or deleted in a particular order. (Reading time: under 1 minute)

You can think of the stack as a container, to which we can add items, and remove them. Only the top of this “container” is open, so the item we put in first will be taken out last, and the items we put in last will be taken out first. This is called the last-in-first-out principle.

Get hands-on with 1000+ tech skills courses.