Skip to content

Commit

Permalink
Queue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Oct 18, 2023
1 parent 3066617 commit 43f9406
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class Queue<T> {
}

public enqueue(item: T) {
this.store[this.tail] = item;
this.store.set(this.tail, item);
this.tail++;
}

Expand All @@ -21,7 +21,7 @@ export default class Queue<T> {
if (size <= 0) {
return void 0;
}
const item = this.store[head];
const item = this.store.get(head);
this.store.delete(head);
this.head++;
if (this.head === this.tail) {
Expand Down

0 comments on commit 43f9406

Please sign in to comment.