fix: move queue to utils

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-15 22:46:10 +02:00
parent 01f00eb330
commit dafe85c6d3
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 18 additions and 18 deletions

View file

@ -1,21 +1,3 @@
class Queue {
constructor() {
this.q = [];
}
enqueue(x) {
this.q.push(x);
}
dequeue() {
return this.q.shift();
}
isEmpty() {
return this.q.length == 0;
}
}
class RankedTree {
constructor() {
this.root = null;

View file

@ -12,3 +12,21 @@ Array.prototype.equals = function (other) {
return true;
};
class Queue {
constructor() {
this.q = [];
}
enqueue(x) {
this.q.push(x);
}
dequeue() {
return this.q.shift();
}
isEmpty() {
return this.q.length == 0;
}
}