...

/

Stacks and Queues

Stacks and Queues

Expand the knowledge of collections by learning about stacks and queues.

We'll cover the following...

Stacks

Stacks are a different way to approach collections. With arrays and lists, we can insert data and read it wherever we want. We can insert items in the middle and read from the end, for example. Stacks, however, only let us place and read new items on the top. Consider the following illustrations for better comprehension:

So, stacks are like a deck of cards, or a group of items piled onto each other. We can put new items on the top, and when we want to read values, we start from the top, ...