Stacks and Queues are considered logical data structures. In Java refer to these as Abstract Data Types (ADT) because we can separate the ideas from implementation. For both of these we think about the operations to insert, delete, and peek. We don't really care where it is.
When implementing these ADTs we focus on where exactly the data is inserted and removed.
Stack |
Queue |
Stack is Last In, Last Out (LIFO)
|
Queue is First In, First Out (FIFO)
|
Insert to last, delete from first
Insert to last, delete from first