Skip to content

Added insertion operations for Min Heap and Max Heap in Python#4822

Open
Suhaani-19 wants to merge 1 commit intokeshavsingh3197:masterfrom
Suhaani-19:master
Open

Added insertion operations for Min Heap and Max Heap in Python#4822
Suhaani-19 wants to merge 1 commit intokeshavsingh3197:masterfrom
Suhaani-19:master

Conversation

@Suhaani-19
Copy link

What type of PR is this? (check all applicable)

  • [✅] 🚀 Added Name
  • [✅] ✨ Feature
  • 🌟 stared the repo
  • 🐛 Grammatical Error
  • 📝 Documentation Update
  • 🚩 Other

Description

This PR adds a new Python program demonstrating insertion in both Min Heap and Max Heap using the heapq module.
It includes clear, commented code that explains how heaps work internally in Python — where a Min Heap is implemented by default and a Max Heap is simulated using negated values.

The script contains:

Functions for inserting elements in both heaps

Example demo section with test values

Clean and readable output showing both heap structures

This contribution enhances the repository by adding a classic data structure algorithm in an easy-to-understand format for beginners.

Add Link of GitHub Profile

https://github.com/Suhaani-19

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

Labels

None yet

1 participant