Created
September 25, 2019 03:44
-
-
Save ankitamasand/1291552aeaa064afd0ed6b66642fed1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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