Keep a Moving Minimum in a Deque
Remove expired indices at the front and dominated values at the back.
Adult planning suggestion: about 9–12 · Logic & rule checking
- Players
- 3 with an adult facilitator
- Time
- 15–25 minutes
- Materials
- Printed player sheet or copied paper, pencil and small counters.
Prepare
Use values [4,2,5,1,3] at indices 1–5. Report each full window of three. Start with an empty deque of indices.
Follow the rule
For each new index remove the expired front indices. Then remove back indices while their values are at least the incoming value. Append the new index.
Check each step
Read the value at the front once the window is full. A removed back index cannot outlast the newer smaller or equal value.
Worked example
Trace the queue after inserting 1 at index 4. Explain why the prior candidate 2 can disappear before expiring.
Finish and adapt
Finish after three reported windows. Independently scan each window to check the answers.
Purpose, observation and provenance
Within this activity: Remove expired indices at the front and dominated values at the back.
Ask the checker to point to the move or calculation that decides the outcome.
Our rules, examples and printable diagrams are separately prepared. The earliest inventor of the broader mechanism is not established here.
Minimum queue — Rule or mathematical background for our original paper exercise. The small example and end condition are ours.
Secondary practice: Cooperation and explaining a check.
For a class of 30, use ten groups of three. Prepare one player-material set per group and keep the host key with the adult. Rotate operator, recorder and checker after each worked example; a reader or scribe may help without choosing answers. Avoid public ranking or diagnostic labels.
Age bands are planning suggestions. Background references may address older learners and do not validate suitability for this age band. Goals describe observable actions, not measured long-term gains or institutional endorsement.
Free alternative: Copy the supplied grids, labels and cards onto reused paper. No specialist product is needed. Adults may prepare pieces or act as a scribe.
Printable materials
Preview at 100% scale, with browser headers and footers off. Cut with suitable help. Keep host keys separate. This is a manual tabletop kit, not an online opponent, automatic judge or solver.
Keep a Moving Minimum in a Deque · Player materials
Use values [4,2,5,1,3] at indices 1–5. Report each full window of three. Start with an empty deque of indices.
For each new index remove the expired front indices. Then remove back indices while their values are at least the incoming value. Append the new index.
Read the value at the front once the window is full. A removed back index cannot outlast the newer smaller or equal value.
| Index | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Value | 4 | 2 | 5 | 1 | 3 |
| Window length | 3 | — | — | — | — |
| Step / cell | Decision / value | Rule checked |
|---|---|---|
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
Keep a Moving Minimum in a Deque · Host key — keep separate
At index 3 queue [2,3], min 2. Index 4 removes both back indices, min 1. Index 5 queue [4,5], min 1.
Lead and check
Use values [4,2,5,1,3] at indices 1–5. Report each full window of three. Start with an empty deque of indices.
For each new index remove the expired front indices. Then remove back indices while their values are at least the incoming value. Append the new index.
Read the value at the front once the window is full. A removed back index cannot outlast the newer smaller or equal value.
Trace the queue after inserting 1 at index 4. Explain why the prior candidate 2 can disappear before expiring.
Finish after three reported windows. Independently scan each window to check the answers.
Classroom: ten trios for 30 learners; one kit per trio. Rotate operator, recorder and checker. Age guidance is a planning suggestion; prerequisite support may be necessary.