Queue
Insertion
Deletetion
Applications of Queue
Types of Queue:
- Queue is a linear data structure.
- Like stack, queue is also an ordered list.
- It follows the FCFS or FIFO policy.
- It has one end called the REAR(also called tail) which used to insert new item.
- To removal of existing element called FRONT(also called head).
- The process to add an element into queue is called Enqueue.
- The process of removal of an element from queue is called Dequeue
- FCFS stands for First Come First Serve.
- FIFO stands for First In First Out.
- Example: Queue of Passport Office, ADHAAR Card Office, Traffic Signal Cars
- It has mainly two types of operations.
- Insertion: we can insert value from rear or tail direction.
- Deletion: we can delete or remove value from the front or head direction.
- It can represent by two ways:
- Using Array
- Queue is also a collection of same type of elements.
- So, we can take array for implementing the Queue operations.
- Using Linked List
- Queue can be implemented through Linked List.
Insertion
Deletetion
Applications of Queue
- To shared resource, like a printer, CPU task scheduling, etc.
- To use calling phone at PhoneBooth (STD)
- Handling of interrupts in real-time systems.
Types of Queue:
- Queue operations: Insert & Delete
Tags:
data structure