fix: move queue to utils
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
01f00eb330
commit
dafe85c6d3
2 changed files with 18 additions and 18 deletions
|
@ -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;
|
||||
|
|
18
utils.js
18
utils.js
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue