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

Branches, Kristy #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Branches, Kristy #4

wants to merge 4 commits into from

Conversation

kristyh32
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 do not differentiate that the left child is smaller than the right child, just that both children are larger/smaller than the parent. Heaps are also complete trees because they are filled from left to right.
Could you build a heap with linked nodes? Yes, techinically, but that wouldn't be an efficient way to build a heap because you would lose the O( log n) insert/removal that you have implementing it with an array.
Why is adding a node to a heap an O(log n) operation? It's an O(log n) operation because you add/remove from the end of the list and then you only have to heap up/heap down on half the list.
Were the heap_up & heap_down methods useful? Why? Yes every time you add or remove you need to use the heap_up or heap_down and you can do it recursively.

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