mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-14 21:46:11 +00:00
[PR #1526] feat(data-structure): Add Min Binary Heap implementation in C #2140
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/TheAlgorithms/C/pull/1526
State: closed
Merged: No
Fixes #1497
Description of Change
This Pull Request introduces a complete implementation of a Min Binary Heap data structure in C, utilizing dynamic array representation and proper memory management (
malloc/free).The file is located at
data_structures/binary_tree_in_c/Min Binary Heap.c.Implementation Details
Memory Management:** Dynamic allocation for the underlying array and heap structure.
Core Logic:** Implements
heapify_up(for insertion) andheapify_down(for extraction) to maintain the Min Heap property.Demonstration:** Includes a
main()function demonstrating all operations and memory cleanup.⚙️ Supported Operations & Complexity
O(\log n)O(\log n)O(1)O(n)O(n)References
No specific external references needed.
Checklist
mainfunction)feat(data-structure): Add Min Binary Heap implementation in C)Notes: Implements the requested Min Binary Heap data structure.