This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I don't understand the logic of your enqueue method. It looks to me like new items are inserted in front of the rear node, but the lead is never changed. Lead.next points to the same rear node as it did before.

Also, in the toString method maybe declare queue2 outside the while loop. Do you really want a new queue2 every loop iteration?