Input-Output Machine
A machine rearranges a line of words and numbers by a fixed rule, one element per step, until the line is sorted. How to discover the rule from consecutive steps, then answer questions about a specific step, the final step, and the step count.
What you will be able to do
- Compare two consecutive steps to isolate the single element that moved and where it went.
- State the rule as 'which element is picked' plus 'where it is placed' plus 'when the machine stops'.
- Generate any requested step from the input without writing every step in full once the rule is known.
- Count the total steps as the number of elements the rule still has to place.
What is inside this lesson
- 1A rule applied one step at a time
- 2Finding the rule
- 3Two common rule families
- 4Answering step and count questions
- 5Worked example 1: numbers to the left
- 6Worked example 2: words to the right
- 7Common mistakes
- 8Quick revision
- 9Practice
Get Pro for full access. This is section 1 of 9; the rest of the lesson opens with Pro at onelystop.in/upgrade.
A rule applied one step at a time
You are shown an input line of words and numbers, then a few steps. Each step is the previous line with the machine's fixed rule applied once. After enough steps the line reaches its final form and the machine stops.
The rule always has three parts:
- Which element is picked this step (the largest number, the alphabetically first word, …).
- Where it is placed (extreme left, extreme right, just after the last placed element).
- When the machine stops (when the line is fully sorted by the rule).
Your job is to read those three parts off the given steps, then apply them.
Reading the 9 sections above is free. A free account opens the first 2 topics of every subject in full, along with flashcards and private notes.