Ayu-hack / Hacktoberfest2024-1

This is repo to create some pull requests and completing hacktoberfest 2024 easily. All request will be accepted. Genuine Pull Request will promoted also. #hacktobefest #hacktobefest2024 #hacktobefest-accepted Resources
47 stars 483 forks source link

Implementation of Queue using Array , Linked-list , Deque & Priority Queue #109

Closed kishan-25 closed 3 weeks ago

kishan-25 commented 3 weeks ago

Description:

This issue focuses on implementing a Queue data structure using four different approaches, each offering unique functionalities and use cases. The implementations will include the following:

Array-based Queue: A queue is implemented using a static array with front and rear pointers. It supports the basic operations of a queue (enqueue, dequeue, etc.) but has a fixed size, making it limited in terms of dynamic memory allocation.

Linked List-based Queue: This approach implements the queue using a linked list, where nodes are dynamically allocated as needed. The enqueue operation inserts nodes at the rear, and the dequeue operation removes nodes from the front, making it an efficient dynamic data structure without fixed size limitations.

Deque-based Queue: A deque (double-ended queue) allows both ends to be used for insertion and deletion operations. This provides more flexibility than the standard queue, as you can insert and remove elements from both the front and the rear. It is useful in scenarios where operations on both ends of the queue are required.

Priority Queue: A priority queue is a special type of queue where each element is associated with a priority, and elements are dequeued based on their priority rather than their position in the queue. The highest priority element is dequeued first. This is useful for scenarios like job scheduling and task prioritization.

Goals:

Implement Array-based Queue: Support fixed-size queue operations such as enqueue, dequeue, isFull, and isEmpty. Implement Linked List-based Queue: Allow dynamic queue operations with no size constraints. Implement Deque-based Queue: Enable double-ended insertions and deletions. Implement Priority Queue: Ensure elements are dequeued based on priority instead of order of insertion. Operations to Support:

enqueue(): Insert an element into the queue. dequeue(): Remove an element from the queue. peek(): View the front element of the queue without removing it. isEmpty(): Check if the queue is empty. isFull(): (Array-based only) Check if the queue is full.

Ayu-hack commented 3 weeks ago

Assigned. More repos are available for pull requests, and they’re part of Hacktoberfest 2024. Feel free to tag me in your Hacktoberfest certificate or badges LinkedIn post! 😄

👉 Follow my GitHub and connect with me on LinkedIn! ⭐ Star these repos to stay updated for next year’s Hacktoberfest!