What are a stack and a queue, and where are they used?

3 stars If you are short on time, start with this one.

In one or two sentences
A stack is last in, first out. A queue is first in, first out.

Think of your own answer first

Say it out loud, or type it below. What you type never leaves this device.

Follow-up questions

These are likely next questions from an interviewer. Think of your answer first, then press the button.

  1. 1 / 3

    Can you build a queue from two stacks?

Sources checked

This is a textbook level concept, so no outside source is listed.