Insane number of adds to setup env and packages
This commit is contained in:
48
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
48
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class PriorityQueue<T> extends Base {
|
||||
/**
|
||||
* @description PriorityQueue's constructor.
|
||||
* @param container Initialize container, must have a forEach function.
|
||||
* @param cmp Compare function.
|
||||
* @param copy 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.
|
||||
*/
|
||||
constructor(container?: initContainer<T>, cmp?: (x: T, y: T) => number, copy?: boolean);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Push element into a container in order.
|
||||
* @param item The element you want to push.
|
||||
*/
|
||||
push(item: T): void;
|
||||
/**
|
||||
* @description Removes the top element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Accesses the top element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
/**
|
||||
* @description Check if element is in heap.
|
||||
* @param item The item want to find.
|
||||
* @return Boolean about if element is in heap.
|
||||
*/
|
||||
find(item: T): boolean;
|
||||
/**
|
||||
* @description Remove specified item from heap.
|
||||
* @param item The item want to remove.
|
||||
* @return Boolean about if remove success.
|
||||
*/
|
||||
remove(item: T): boolean;
|
||||
/**
|
||||
* @description Update item and it's pos in the heap.
|
||||
* @param item The item want to update.
|
||||
* @return Boolean about if update success.
|
||||
*/
|
||||
updateItem(item: T): boolean;
|
||||
/**
|
||||
* @return Return a copy array of heap.
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
export default PriorityQueue;
|
||||
112
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
112
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
class PriorityQueue extends _ContainerBase.Base {
|
||||
constructor(t = [], s = ((t, s) => {
|
||||
if (t > s) return -1;
|
||||
if (t < s) return 1;
|
||||
return 0;
|
||||
}), i = true) {
|
||||
super();
|
||||
this.p = s;
|
||||
if (Array.isArray(t)) {
|
||||
this._ = i ? [ ...t ] : t;
|
||||
} else {
|
||||
this._ = [];
|
||||
t.forEach((t => this._.push(t)));
|
||||
}
|
||||
this.o = this._.length;
|
||||
const e = this.o >> 1;
|
||||
for (let t = this.o - 1 >> 1; t >= 0; --t) {
|
||||
this.v(t, e);
|
||||
}
|
||||
}
|
||||
B(t) {
|
||||
const s = this._[t];
|
||||
while (t > 0) {
|
||||
const i = t - 1 >> 1;
|
||||
const e = this._[i];
|
||||
if (this.p(e, s) <= 0) break;
|
||||
this._[t] = e;
|
||||
t = i;
|
||||
}
|
||||
this._[t] = s;
|
||||
}
|
||||
v(t, s) {
|
||||
const i = this._[t];
|
||||
while (t < s) {
|
||||
let s = t << 1 | 1;
|
||||
const e = s + 1;
|
||||
let h = this._[s];
|
||||
if (e < this.o && this.p(h, this._[e]) > 0) {
|
||||
s = e;
|
||||
h = this._[e];
|
||||
}
|
||||
if (this.p(h, i) >= 0) break;
|
||||
this._[t] = h;
|
||||
t = s;
|
||||
}
|
||||
this._[t] = i;
|
||||
}
|
||||
clear() {
|
||||
this.o = 0;
|
||||
this._.length = 0;
|
||||
}
|
||||
push(t) {
|
||||
this._.push(t);
|
||||
this.B(this.o);
|
||||
this.o += 1;
|
||||
}
|
||||
pop() {
|
||||
if (!this.o) return;
|
||||
const t = this._.pop();
|
||||
this.o -= 1;
|
||||
if (this.o) {
|
||||
this._[0] = t;
|
||||
this.v(0, this.o >> 1);
|
||||
}
|
||||
}
|
||||
top() {
|
||||
return this._[0];
|
||||
}
|
||||
find(t) {
|
||||
return this._.indexOf(t) >= 0;
|
||||
}
|
||||
remove(t) {
|
||||
const s = this._.indexOf(t);
|
||||
if (s < 0) return false;
|
||||
if (s === 0) {
|
||||
this.pop();
|
||||
} else if (s === this.o - 1) {
|
||||
this._.pop();
|
||||
this.o -= 1;
|
||||
} else {
|
||||
this._.splice(s, 1, this._.pop());
|
||||
this.o -= 1;
|
||||
this.B(s);
|
||||
this.v(s, this.o >> 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
updateItem(t) {
|
||||
const s = this._.indexOf(t);
|
||||
if (s < 0) return false;
|
||||
this.B(s);
|
||||
this.v(s, this.o >> 1);
|
||||
return true;
|
||||
}
|
||||
toArray() {
|
||||
return [ ...this._ ];
|
||||
}
|
||||
}
|
||||
|
||||
var _default = PriorityQueue;
|
||||
|
||||
exports.default = _default;
|
||||
18
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
18
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Queue<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Inserts element to queue's end.
|
||||
*/
|
||||
push(element: T): void;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Access the first element.
|
||||
*/
|
||||
front(): T | undefined;
|
||||
}
|
||||
export default Queue;
|
||||
44
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js
generated
vendored
Normal file
44
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Deque = _interopRequireDefault(require("../SequentialContainer/Deque"));
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
function _interopRequireDefault(e) {
|
||||
return e && e.t ? e : {
|
||||
default: e
|
||||
};
|
||||
}
|
||||
|
||||
class Queue extends _ContainerBase.Base {
|
||||
constructor(e = []) {
|
||||
super();
|
||||
this.q = new _Deque.default(e);
|
||||
this.o = this.q.size();
|
||||
}
|
||||
clear() {
|
||||
this.q.clear();
|
||||
this.o = 0;
|
||||
}
|
||||
push(e) {
|
||||
this.q.pushBack(e);
|
||||
this.o += 1;
|
||||
}
|
||||
pop() {
|
||||
this.q.popFront();
|
||||
if (this.o) this.o -= 1;
|
||||
}
|
||||
front() {
|
||||
return this.q.front();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Queue;
|
||||
|
||||
exports.default = _default;
|
||||
18
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
18
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Stack<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Insert element to stack's end.
|
||||
*/
|
||||
push(element: T): void;
|
||||
/**
|
||||
* @description Removes the end element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Accesses the end element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
}
|
||||
export default Stack;
|
||||
36
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js
generated
vendored
Normal file
36
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
class Stack extends _ContainerBase.Base {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
this.C = [];
|
||||
t.forEach((t => this.push(t)));
|
||||
}
|
||||
clear() {
|
||||
this.o = 0;
|
||||
this.C.length = 0;
|
||||
}
|
||||
push(t) {
|
||||
this.C.push(t);
|
||||
this.o += 1;
|
||||
}
|
||||
pop() {
|
||||
this.C.pop();
|
||||
if (this.o > 0) this.o -= 1;
|
||||
}
|
||||
top() {
|
||||
return this.C[this.o - 1];
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Stack;
|
||||
|
||||
exports.default = _default;
|
||||
Reference in New Issue
Block a user