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 - Diana #32

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

Space - Diana #32

wants to merge 3 commits into from

Conversation

dnguye2
Copy link

@dnguye2 dnguye2 commented Dec 30, 2020

Heaps Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How is a Heap different from a Binary Search Tree? Heaps only have ordering in which the children nodes are less than or greater than its parent depending on whether it is a max or min heap. BSTs on the other hand have its siblings sorted in either a (preorder/postorder/inorder) fashion.
Could you build a heap with linked nodes? Yup
Why is adding a node to a heap an O(log n) operation? To add a node we always add it to the bottom of the heap and bubble up the node to its correct place, in the worst case this means traversing the height of the tree which has a height of logn.
Were the heap_up & heap_down methods useful? Why? Yes it allowed to maintain the heap structure when adding or removing a node

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