Lines Matching refs:heap
4014 // Binary min-heap implementation used for priority queue.
4018 this.heap = []; property
4023 return this.heap.length;
4027 this.heap = []; property
4034 while (index > 0 && smaller(this.heap[index], this.heap[p=parent(index)])) {
4035 let t = this.heap[index];
4036 this.heap[index] = this.heap[p];
4037 this.heap[p] = t;
4046 while ((l=leftChi(index)) < this.heap.length) {
4047 if (l+1 < this.heap.length && smaller(this.heap[l+1], this.heap[l])) {
4051 if (smaller(this.heap[index], this.heap[l])) {
4055 let t = this.heap[index];
4056 this.heap[index] = this.heap[l];
4057 this.heap[l] = t;
4065 this.heap.push(node);
4066 this.percUp(this.heap.length-1);
4070 return this.heap.push(node);
4074 let [top] = this.heap;
4076 this.heap[0] = this.heap[this.heap.length-1];
4077 this.heap.pop();
4088 for (let i = 0; i < this.heap.length; i++) {
4089 yield this.heap[i].data;
4095 for (let i = 0; i < this.heap.length; i++) {
4096 if (!testFn(this.heap[i])) {
4097 this.heap[j] = this.heap[i];
4102 this.heap.splice(j);
4104 for (let i = parent(this.heap.length-1); i >= 0; i--) {