Skip to content
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

Angela #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Angela #6

wants to merge 1 commit into from

Conversation

AngelaOh
Copy link

Heaps Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How is a Heap different from a Binary Search Tree? Heaps are filled from left to right within each level. The parent node is always smaller than its children in a min heap while the opposite is true for a max heap.
Could you build a heap with linked nodes? You probably shouldn't because having access to an array's index helps the time complexity a lot.
Why is adding a node to a heap an O(log n) operation? You are looking at each level of the heap.
Were the heap_up & heap_down methods useful? Why? YES. You need heap_up when adding to a heap and heap_down when you are removing. They are recursive helper methods.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Nice work! You hit all the learning goals here. Well done.

Comment on lines +17 to +18
# Time Complexity: O(logn) where n is the number of nodes
# Space Complexity: O(logn)

Choose a reason for hiding this comment

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

Great!

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