Hi, a data structure is a way of organizing information with optimal runtime complexity for adding or removing records.
Let see the data structure called Queue
A queue can be like a container source where pieces of data enter into the queue and exit on the other side
We can think in the queue as a line that is waiting in line for buy tickets in the movie theater.
In this example you can image that the line of people waiting to get to the ticket counter is very much like a queue because a person will enter into the line at the very end then they have to wait in the line until is their turn to emerge from it and approach to ticket counter.
In a queue there is not idea of skipping or cutting in line so the order in which you get into the queue also dictates the order which you come out.
The process of adding a record into the queue is called as “Enqueuing or adding”
The process to taken a record from the other side of the queue is called “Dequeuing or removing”
A queue refers to “FIFO” that means First In First Out.
We will implement a queue in the next post.
By Cristina Rojas.