Skip to content

Conversation

@anakp07
Copy link

@anakp07 anakp07 commented Jun 13, 2021

Heaps Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How is a Heap different from a Binary Search Tree?
Could you build a heap with linked nodes? Yes
Why is adding a node to a heap an O(log n) operation? Due to the number of levels in the heap and the max num of swaps is equal to the amount of levels
Were the heap_up & heap_down methods useful? Why? Yes

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.

Ana, the code you have works, but you're missing the heap_down function. Do you need help with it? We can meet in office hours or by appointment.

Comment on lines 4 to 6
# Time Complexity: ?
# Space Complexity: ?
def heap_sort(list)

Choose a reason for hiding this comment

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

👍 Time/space complexity?

Comment on lines 17 to 19
# Time Complexity: ?
# Space Complexity: ?
def add(key, value = key)

Choose a reason for hiding this comment

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

👍 Time/space complexity?

Comment on lines 26 to 28
# Time Complexity: ?
# Space Complexity: ?
def remove()

Choose a reason for hiding this comment

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

👍 Time/space complexity?

Comment on lines 56 to 58
# Time complexity: ?
# Space complexity: ?
def empty?

Choose a reason for hiding this comment

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

👍

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