What is the difference between Stack and Queue?
Stack | Queue | |
---|---|---|
1. | Objects accessed on Last In First Out (LIFO). | Objects accessed on First In First Out (FIFO) |
2. | Object pushed on top of collection | Object inserted at the end |
3. | Object removed from the top | Object removed from the beginning. |
4. | Two operations are called push and pop | Two operations are called enqueue and dequeue |
BY Best Interview Question ON 13 Jan 2019