I. Why?
Because in JS, there is NO such useful build-in data structure🤣…….
[Great Links]: https://www.cs.usfca.edu/~galles/visualization/Heap.html
II. Time Complexity
- construct: O(n)
- peek: O(1)
- offer: O(lgn)
- poll: O(lgn)
III. Implementation
1 |
|
Because in JS, there is NO such useful build-in data structure🤣…….
[Great Links]: https://www.cs.usfca.edu/~galles/visualization/Heap.html
1 |
|