Pregunta de entrevista de Introspect Technology

What is the difference between a stack and a queue?

Respuesta de la entrevista

Anónimo

28 jun 2021

A stack is an ordered list of elements where items enter and exit from the same side (i.e., items can be popped off of or pushed on the stack, and the first element to be put on is the last one to be taken off). A queue on the other hand allows elements to be added from one side and removed on the other side. This allows for the first-in-first-out structure, and may be modeled by a linked-list.