From a3f4508281294f401fd402150dcf9287d876f255 Mon Sep 17 00:00:00 2001 From: Revone Date: Thu, 16 Nov 2023 21:11:50 +0800 Subject: [PATCH] feat: The performance report generator supports parameter filtering commands, which can be used to run specific tests individually. It generates individual performance comparison reports. Enrich the COMMANDS.md document. --- src/data-structures/heap/heap.ts | 114 ------------------------------- 1 file changed, 114 deletions(-) diff --git a/src/data-structures/heap/heap.ts b/src/data-structures/heap/heap.ts index 3dabf98..b7b8287 100644 --- a/src/data-structures/heap/heap.ts +++ b/src/data-structures/heap/heap.ts @@ -784,117 +784,3 @@ export class FibonacciHeap { } } } - - -// export class CHeap { -// -// protected _length = 0; -// private readonly _priorityQueue: T[] = []; -// private readonly _cmp: (x: T, y: T) => number; -// -// constructor( -// cmp: (x: T, y: T) => number = -// function (x: T, y: T) { -// if (x > y) return -1; -// if (x < y) return 1; -// return 0; -// }, -// copy = true -// ) { -// -// this._cmp = cmp; -// -// } -// -// clear() { -// this._length = 0; -// this._priorityQueue.length = 0; -// } -// -// push(item: T) { -// this._priorityQueue.push(item); -// this._pushUp(this._length); -// this._length += 1; -// } -// -// pop() { -// if (this._length === 0) return; -// const value = this._priorityQueue[0]; -// const last = this._priorityQueue.pop()!; -// this._length -= 1; -// if (this._length) { -// this._priorityQueue[0] = last; -// this._pushDown(0, this._length >> 1); -// } -// return value; -// } -// -// top(): T | undefined { -// return this._priorityQueue[0]; -// } -// -// find(item: T) { -// return this._priorityQueue.indexOf(item) >= 0; -// } -// -// remove(item: T) { -// const index = this._priorityQueue.indexOf(item); -// if (index < 0) return false; -// if (index === 0) { -// this.pop(); -// } else if (index === this._length - 1) { -// this._priorityQueue.pop(); -// this._length -= 1; -// } else { -// this._priorityQueue.splice(index, 1, this._priorityQueue.pop()!); -// this._length -= 1; -// this._pushUp(index); -// this._pushDown(index, this._length >> 1); -// } -// return true; -// } -// -// updateItem(item: T) { -// const index = this._priorityQueue.indexOf(item); -// if (index < 0) return false; -// this._pushUp(index); -// this._pushDown(index, this._length >> 1); -// return true; -// } -// -// toArray() { -// return [...this._priorityQueue]; -// } -// -// private _pushUp(pos: number) { -// const item = this._priorityQueue[pos]; -// while (pos > 0) { -// const parent = (pos - 1) >> 1; -// const parentItem = this._priorityQueue[parent]; -// if (this._cmp(parentItem, item) <= 0) break; -// this._priorityQueue[pos] = parentItem; -// pos = parent; -// } -// this._priorityQueue[pos] = item; -// } -// -// private _pushDown(pos: number, halfLength: number) { -// const item = this._priorityQueue[pos]; -// while (pos < halfLength) { -// let left = pos << 1 | 1; -// const right = left + 1; -// let minItem = this._priorityQueue[left]; -// if ( -// right < this._length && -// this._cmp(minItem, this._priorityQueue[right]) > 0 -// ) { -// left = right; -// minItem = this._priorityQueue[right]; -// } -// if (this._cmp(minItem, item) >= 0) break; -// this._priorityQueue[pos] = minItem; -// pos = left; -// } -// this._priorityQueue[pos] = item; -// } -// }