Update item and it's pos in the heap.
Whether update success.
const que = new PriorityQueue([], (x, y) => x.id - y.id);
const obj = { id: 1 };
que.push(obj);
obj.id = 2;
que.updateItem(obj);
The item want to update.
PriorityQueue's constructor.
new PriorityQueue();
new PriorityQueue([1, 2, 3]);
new PriorityQueue([1, 2, 3], (x, y) => x - y);
new PriorityQueue([1, 2, 3], (x, y) => x - y, false);
Initialize container, must have a forEach function.
Compare function.
When the container is an array, you can choose to directly operate on the original object of the array or perform a shallow copy. The default is shallow copy.
Generated using TypeDoc
Returns
The size of the container.
Example