* @zh 更新元素(重新排序) * @en Update element (re-sort)
(item: T)
| 77 | * @en Update element (re-sort) |
| 78 | */ |
| 79 | update(item: T): void { |
| 80 | const index = this.heap.indexOf(item); |
| 81 | if (index !== -1) { |
| 82 | this.bubbleUp(index); |
| 83 | this.sinkDown(index); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @zh 检查是否包含元素 |
no test coverage detected