QUEUE
QUEUE
A queue is another fundamental data structure in computer science that follows the FIFO (First In, First Out) principle. In a queue, the first element added (enqueued) is the first one to be removed (dequeued), similar to how people line up in a queue at a ticket counter or grocery store: the first person to arrive is the first to be served.
Key Characteristics of a Queue:
First In, First Out (FIFO): The first element added to the queue is the first one to be removed.
Enqueue: The operation to add an element to the queue.
Dequeue: The operation to remove the element from the front of the queue.
Front: Refers to the element at the front of the queue (the one that will be dequeued next).
Rear (Back): Refers to the element at the back of the queue (the last one added).
IsEmpty: Checks if the queue is empty.
Size: Returns the number of elements currently in the queue