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

[DO NOT MERGE] added SimpleMinHeap #316

Closed
wants to merge 3 commits into from

Conversation

masters3d
Copy link
Contributor

waiting for exercism/problem-specifications#1128

Missing Readme.md

@robtimp
Copy link
Contributor

robtimp commented Jan 16, 2018

Looks good so far!

if(rightChildIndex < array.count && ((rightChildIndex - 1)/2) == index ) {
let left = array[leftChildIndex]
let right = array[rightChildIndex]
let minChildIndex = left < right ? leftChildIndex : rightChildIndex
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If left == right, which side should I choose? Does it matter? This impl chooses right side.

}
}
// Convinience function that takes in a array converts it into a heap
mutating func heapify(_ input: [T]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implement a better heapifi. Not sure how to test though. Ideas https://github.com/williamfiset/data-structures/blob/master/PriorityQueue/PQueue.java

@masters3d
Copy link
Contributor Author

Too Specific Seems like: exercism/problem-specifications#761

@masters3d masters3d closed this Jan 25, 2018
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