mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-14 23:12:58 +08:00
Compare commits
2 Commits
73efc1c2ae
...
49f15c4532
Author | SHA1 | Date | |
---|---|---|---|
|
49f15c4532 | ||
|
587648a11e |
@ -22,7 +22,7 @@ export default class PriorityQueue extends MinHeap {
|
|||||||
* @param {number} [priority] - items priority.
|
* @param {number} [priority] - items priority.
|
||||||
* @return {PriorityQueue}
|
* @return {PriorityQueue}
|
||||||
*/
|
*/
|
||||||
add(item, priority = 0) {
|
add(item, priority = item) {
|
||||||
this.priorities.set(item, priority);
|
this.priorities.set(item, priority);
|
||||||
super.add(item);
|
super.add(item);
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
Reference in New Issue
Block a user