Skip to content

Conversation

@Vedanth-Rach
Copy link

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) and heapify_down (for extraction) to maintain the Min Heap property.
Demonstration:** Includes a main() function demonstrating all operations and memory cleanup.

⚙️ Supported Operations & Complexity

Operation Time Complexity
Insert $O(\log n)$
Extract Min $O(\log n)$
Get Min (Peek) $O(1)$
Search $O(n)$
Display $O(n)$

References

No specific external references needed.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass (Included in the main function)
  • Relevant documentation/comments is changed or added (Added extensive function documentation and header comments)
  • PR title follows semantic commit guidelines (The title should be feat(data-structure): Add Min Binary Heap implementation in C)
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: Implements the requested Min Binary Heap data structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant