Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MinHeap {
constructor () {
/* Initialing the array heap and adding a dummy element at index 0 */
this.heap = [null]
}
getMin () {
/* Accessing the min element at index 1 in the heap array */
return this.heap[1]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment