Unlike a stack, a queue is a FIFO data structure (first in, first out). This should be intuitive to you. After all, if you join the queue first, you expect to get served first.
Like a stack it can implemented statically, using an array, or dynamically, using a linked list.
Your task is to think about how you would implement a queue in both of these situations. There are problems with both the static and the dynamic method.
- What is the problem when you use an array? How can you solve it?
- What is the problem when you use a linked list? What is the solution?
- What are queues used for in computer systems? Document two examples on your website.
- Make sure you also have two uses for stacks.
- Implement a queue using java.util.LinkedList