Pregunta

What is the difference between the stack and the queue when it comes to data storage?

¿Fue útil?

Solución

A stack works like a tray of dirty dishes, the first one you put on the stack will be the last one out of the stack. The last one on the stack will be the first one popped off the stack (Last in first out).

The queue works in the same way a line at the supermarket works. The first one in a queue will be the first one out of the queue(First in first out).

Otros consejos

Stack - first in first out.

Queue - first in last out

Various methods to implement

Does that answer your homework

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top