Skip to content

Conversation

@amythetester
Copy link

Heaps Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How is a Heap different from a Binary Search Tree? A heap is not necessarily in sort order. A binary search tree must be in sort order or else it is just s binary tree.
Could you build a heap with linked nodes? You could, but I think it would need to be doubly links for it to work the same.
Why is adding a node to a heap an O(log n) operation? Because you are reducing the values you have to deal with in half for each heap_up operation.
Were the heap_up & heap_down methods useful? Why? 100%, they kept the add and remove methods simple. They also were able to be solely responsible for order.

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. Perfect solutions. Nice job.

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