Skip to content

Stacks and Queues

Arghun-dev edited this page Sep 26, 2021 · 1 revision

Stacks and Queues they are both data structures

A LIFO data structure!

The last element added to the stack will be the first element removed from the stack.

How is it used?

think about a stack of plates or stack of markers or a stack of anything. As you pile it up the last thing (or the top most thing) is what gets removed first.

So again, stack is just a collection of data, and the first thing that you added in is the last thing to be removed, the last thing to be added in is the first thing to be removed.

Clone this wiki locally