rename modules after moving to appropriate folders

This commit is contained in:
buzz-lightsnack-2007 2024-04-26 21:32:32 +08:00
parent 0b7be21d03
commit a226f12645
16 changed files with 17 additions and 17 deletions

41
scripts/utils/common.js Normal file
View file

@ -0,0 +1,41 @@
// common.js provides the advanced data structures.
export class Queue {
#elements;
constructor() {
this.#elements = [];
}
enqueue(element) {
this.#elements.push(element);
}
dequeue() {
return this.#elements.shift();
}
isEmpty() {
return this.#elements.length <= 0;
}
}
export class Stack {
#elements;
constructor() {
this.#elements = [];
}
push(element) {
this.#elements.push(element);
}
pop() {
return this.#elements.pop();
}
isEmpty() {
return this.#elements.length <= 0;
}
}