Skip to content

Min head with decrease key functionality #1202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 25, 2019
Merged

Conversation

Raj1998
Copy link
Contributor

@Raj1998 Raj1998 commented Sep 25, 2019

I have added MinHeap data structure with decrease key function in O(logn) time. I have also added sample usage at the bottom.

Please let me know if there are any changes.

@cclauss
Copy link
Member

cclauss commented Sep 25, 2019

Please add at least one https://docs.python.org/3/library/doctest.html

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

We are getting there but I think one thing that we are missing in the ability to get the value given the key (name) as in print(myMinHeap("X")) # -> 1

Not much value in a heap that you can not get the data back out of ;-)

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Awesome work! Congratulations and thanks!! 🍰

@cclauss cclauss merged commit 6ac7b13 into TheAlgorithms:master Sep 25, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Min head with decrease key functionality

* doctest added

* __str__ changed as per Python convention

* edits in doctest

* get_value by key added

* __getitem__ added
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.

2 participants