Pregunta de entrevista de Tata Consultancy Services

Can you explain the difference between a stack and a queue?

Respuesta de la entrevista

Anónimo

20 mar 2025

A stack follows the LIFO (Last In, First Out) principle, where the last element added is the first to be removed (e.g., a stack of plates). A queue follows the FIFO (First In, First Out) principle, where the first element added is the first to be removed (e.g., a line of people at a ticket counter).