Skip to content

Instantly share code, notes, and snippets.

@kalub92
Created March 5, 2018 22:23
Show Gist options
  • Save kalub92/3c8ef1c07f95464bc570f4e15704d53a to your computer and use it in GitHub Desktop.
Save kalub92/3c8ef1c07f95464bc570f4e15704d53a to your computer and use it in GitHub Desktop.
mutating private func heapifyUp() {
var index = items.count - 1
while hasParent(index) && parent(index) > items[index] {
swap(indexOne: getParentIndex(index), indexTwo: index)
index = getParentIndex(index)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment