Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Conversation

Chiefpatwal
Copy link

This PR adds a generic MinHeap implementation in Java to the repository. The class includes the following features:

Insertion (insert(T data)): Adds a new element while maintaining the min-heap property.

Extraction of minimum (extractMin()): Removes and returns the smallest element.

Peek (peek()): Returns the minimum element without removing it.

Check if empty (isEmpty()): Returns true if the heap is empty.

Size (size()): Returns the number of elements in the heap.

Height (height()): Returns the height of the heap.

Print heap (printHeap()): Prints elements in level order for debugging purposes.

@Chiefpatwal Chiefpatwal changed the title Add MinHeap class implementation in JavaThis PR adds a generic MinHeap implementation in Java to the repository. The class includes the following features: Insertion (insert(T data)): Adds a new element while maintaining the min-heap property. Extraction of minimum (extractMin()): Removes and returns the smallest element. Peek (peek()): Returns the minimum element without removing it. Check if empty (isEmpty()): Returns true if the heap is empty. Size (size()): Returns the number of elements in the heap. Height (height()): Returns the height of the heap. Print heap (printHeap()): Prints elements in level order for debugging purposes. Add MinHeap class implementation in Java Oct 1, 2025
@Chiefpatwal
Copy link
Author

please review and merge the pr

Copy link
Owner

@yesiamrajeev yesiamrajeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention the issue here

@Chiefpatwal
Copy link
Author

This PR adds a generic MinHeap implementation in Java to the repository. The class includes the following features:

Insertion (insert(T data)): Adds a new element while maintaining the min-heap property.

Extraction of minimum (extractMin()): Removes and returns the smallest element.

Peek (peek()): Returns the minimum element without removing it.

Check if empty (isEmpty()): Returns true if the heap is empty.

Size (size()): Returns the number of elements in the heap.

Height (height()): Returns the height of the heap.

Print heap (printHeap()): Prints elements in level order for debugging purposes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants