-
Notifications
You must be signed in to change notification settings - Fork 34
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
Faiza #21
base: master
Are you sure you want to change the base?
Faiza #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall not bad, but there are small issues. Take a look at my comments and see if they make sense. Let me know any questions you have.
swap(0, @store.length - 1) | ||
removed_node = @store.pop | ||
heap_down(0) | ||
return removed_node.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting a NoMethodError
here in the "can sort a 5-element array" test.
def heapsort(list) | ||
return list if list.empty? || list.length == 1 | ||
|
||
minHeap = MinHeap.new() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note that coding style for minHeap
should be min_heap
if @store.empty? | ||
return | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're returning nil
if @store.empty?
I would instead return @store.empty?
Heaps Practice
Congratulations! You're submitting your assignment!
Comprehension Questions
heap_up
&heap_down
methods useful? Why?