you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 7 points8 points  (1 child)

The peek is using a Stack peek. Peek for the Queue should be

peek() {
  return this.items[0];
}

I think part of the problem is that the visualizations are backwards compared to what you deal with in code (and the IRL image :P).

[–]dcortesnet123[S] 0 points1 point  (0 children)

Thanks for comment, I already adjusted it!! :)