A stack is: last in / first out
A queue is: first in / first out
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
The purpose of the queue is to ensure the elements are given treatment in the order they were received.
The intended purpose is really the difference.
In actuality, you can do anything you want with either given enough memory and a proper algorithm.
...but I'm sure that's outside of the spirit and intention of your question.
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
There's one other structure that is available -- a dequeue (pronounced DECK).
Items can be added and removed from either end. This may be what you need.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944