AlgoGenesis / C

AlgoGenesis is a centralized open-source platform dedicated to providing optimized and well-documented algorithm implementations in C. Perfect for both beginners and advanced users, this repository serves as a comprehensive learning resource for solving algorithmic challenges.
MIT License
80 stars 247 forks source link

[NEW ALGORITHM] :Priority Queue using a Heap #1241

Open REHAN-18 opened 2 hours ago

REHAN-18 commented 2 hours ago

Issue will be closed if:

1) You mention more than one algorithm. You can create a separate issue for each algorithm once the current one is completed.
2) You propose an algorithm that is already present or has been mentioned in a previous issue.
3) You create a new issue without completing your previous issue.

Note: These actions will be taken seriously. Failure to follow the guidelines may result in the immediate closure of your issue.


Name:

[NEW ALGORITHM]Priority Queue using a Heap

About:

A Priority Queue is an abstract data type that operates similarly to a regular queue but with an added feature: each element has a priority associated with it. In a priority queue, elements with higher priority are dequeued before elements with lower priority. This implementation utilizes a binary heap, which provides an efficient way to maintain the priority queue.

Implementation Details:

1-Binary Heap: The binary heap can be either a min-heap (where the smallest element is at the top) or a max-heap (where the largest element is at the top). Here, we will implement a min-heap for the priority queue.

-Operations:

Insert: Insert a new element into the heap. Extract-Min: Remove and return the element with the highest priority (smallest value in the case of a min-heap). Peek: Return the element with the highest priority without removing it. IsEmpty: Check if the priority queue is empty.

Complexity:

1-Insert: O(log n) 2-Extract-Min: O(log n) 3-Peek: O(1)

Labels:

new algorithm, gssoc-ext, hacktoberfest, level1


Assignees:

github-actions[bot] commented 2 hours ago

👋 Thank you for raising an issue! We appreciate your effort in helping us improve. Our team will review it shortly. Stay tuned!

REHAN-18 commented 2 hours ago

@pankaj-bind pls see this issue I want to add new algo can I start my work!!????