diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index 3e52eb0f..4ff2f466 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -20,30 +20,30 @@ O(n), where n is the number of elements in the queue. ## Queue Operations: -1) Initialize a Queue: --Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. -2) Enqueue (Insertion): --To add an element to the queue, insert it at the rear (end) of the queue. +1) Initialize a Queue: +- Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. +2) Enqueue (Insertion): +- To add an element to the queue, insert it at the rear (end) of the queue. -Increment the rear pointer to point to the newly added element. -Ensure the queue remains in the correct order, following the FIFO principle. -3) Dequeue (Removal): --To remove an element from the queue, take it from the front. --Increment the front pointer to point to the next element in the queue. --Make sure to handle the case when the queue becomes empty. -4) Peek (Accessing the Front Element): --To access the element at the front of the queue without removing it, simply refer to the front element. --This is useful for checking what's at the front of the queue without altering its contents. -5) Check if Queue is Empty: --You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. -6) Check if Queue is Full (if using a fixed-size array): --In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. +3) Dequeue (Removal): +- To remove an element from the queue, take it from the front. +- Increment the front pointer to point to the next element in the queue. +- Make sure to handle the case when the queue becomes empty. +4) Peek (Accessing the Front Element): +- To access the element at the front of the queue without removing it, simply refer to the front element. +- This is useful for checking what's at the front of the queue without altering its contents. +5) Check if Queue is Empty: +- You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. +6) Check if Queue is Full (if using a fixed-size array): +- In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. ## Sourse: --[Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) +- [Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) ## Video URL: --[Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) --[Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) --[Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) +- [Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) +- [Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) +- [Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) ## Others: Queues can be implemented using arrays, linked lists, or specialized queue data structures depending on the specific requirements. They are crucial in scenarios where tasks or data need to be processed in a specific order, ensuring fairness and proper management.