Monday, March 16, 2020

STACK AND QUEUE

Stack

Imagine a tube, you fill it with coins. You insert 10 different coins, you want to reach the first coin you inserted but you need to remove the coins before it.

Stack follows the rule of last in first out which means the last one you inserted is the first one to go out.

It contains two functions which is:
1)To add/ Push()

2)To delete/Pop()

Stack visualized


QUEUE

The name is self explainatory, imagine a supermarket queue, then first one to reach is served first.
Same thing here queue means to lineup in sequential order.

It contains 5 function:
1) To add/Enqueue
2)To delete/Dequeue
3)To clear/Clear
4)To check if empty/IsEmpty
5)To check if full/IsFull
QUEUE VISUALIZED
steam- http://steamcommunity.com/id/michaelhxd/
 

No comments:

Post a Comment