What is stack and queue?
What is stack and queue?
• A stack is generally First In, Last Out (FILO), and a queue is First in First Out (FIFO).
• Item can be added or removed only at one end in stack and in a queue insertion at the rear and deletion from the front.
• The basic operation of stack is 'push' and 'pop', in queue are 'enque' and 'dequeue'.
• The main difference is that one is a real implementation (Stack) while the other is an interface (Queue) thus involve that extra functionality is offered by the real classes that implement the Queue interface like blocking, and synchronization.
Bookmarks