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

Space - Katie #34

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

Space - Katie #34

wants to merge 3 commits into from

Conversation

ktvoort123
Copy link

Heaps Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How is a Heap different from a Binary Search Tree? In a heap, the elements in higher levels are greater than or less than the items in lower levels (depending on if it is max or min heap). However, in a BST, the items from left to right are in order.
Could you build a heap with linked nodes? Yes, you can implement a heap with linked TreeNode objects, but it's easier to implement a heap with an array.
Why is adding a node to a heap an O(log n) operation? Adding a node to a heap is and O(log n) operation because there are Log n levels to the heap.
Were the heap_up & heap_down methods useful? Why? Yes, because it helps compare the nodes and swaps them if they are out of order when adding and removing nodes.

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