Input-Output and Machine Arrangement
Arrangement Machines: Shift and Alternating Patterns
In an arrangement machine the items are not changed, only moved. The two commonest patterns are shown with a full trace. Pattern 1, selection shift: in step k the k-th smallest number is brought to the k-th place from the left and the others shift right, keeping their order. Input 52 17 38 9 24 gives the lines below.
| Line | Numbers | What moved |
|---|---|---|
| Input | 52 17 38 9 24 | - |
| Step I | 9 52 17 38 24 | 9, smallest, to place 1 |
| Step II | 9 17 52 38 24 | 17 to place 2 |
| Step III | 9 17 24 52 38 | 24 to place 3 |
| Step IV | 9 17 24 38 52 | 38 to place 4: sorted, stop |
For n numbers this machine needs at most n − 1 steps, because once n − 1 places are right the last one is right too. Here n = 5 and it took 4 steps.
Pattern 2, alternating ends: step I brings the largest to the left end, step II sends the smallest to the right end, step III brings the second largest to place 2 from the left, step IV sends the second smallest to place 2 from the right, and so on. Input 34 71 18 52 9 63:
| Line | Numbers |
|---|---|
| Step I (largest 71 to the left end) | 71 34 18 52 9 63 |
| Step II (smallest 9 to the right end) | 71 34 18 52 63 9 |
| Step III (63 to place 2 from the left) | 71 63 34 18 52 9 |
| Step IV (18 to place 2 from the right) | 71 63 34 52 18 9 |
| Step V (52 to place 3 from the left) | 71 63 52 34 18 9 |
The same patterns work on words once the order is fixed. If the order is the number of letters, input loan fee interest cheque deposit (4, 3, 8, 6, 7 letters) under Pattern 2 gives Step I interest loan fee cheque deposit, Step II interest loan cheque deposit fee, Step III interest deposit loan cheque fee and Step IV interest deposit cheque loan fee.
Spotting the Rule from Two Steps
In the exam you are shown the input and two steps and must find the rule yourself. Compare each step with the line above and ask: which item moved, to which end, and what is special about it (largest, smallest, first alphabetically, longest, odd, even)? Then test your guess on the second step. A guess that fits only step I is not yet a rule.
| What you see | Likely rule |
|---|---|
| One item jumps to the left end each step, results grow from the left | Selection shift (largest or smallest first) |
| Step I changes the left end, step II the right end | Alternating ends |
| Each step changes the numbers' values but the places stay | An operation on every item |
| A step reverses the whole line | A reversal step, as in the next section |
| Even and odd numbers separate to different sides | Grouping rule: evens first, odds last, each group ordered |
Working Backwards: Finding the Input
To find the input from a later step, undo the steps in the reverse order, and undo each step by its inverse. Add becomes subtract, multiply becomes divide, a reversal of the line is undone by reversing again. For a line that was only rearranged, the input is not unique unless the stem fixes it, so backward questions use operations.
Example 1. Step I: add 4 to every number. Step II: double every number. The output is 30 18 40. Undo Step II first (halve): 15 9 20. Then undo Step I (subtract 4): 11 5 16. Check forwards: 11 + 4 = 15, ×2 = 30; 5 + 4 = 9, ×2 = 18; 16 + 4 = 20, ×2 = 40.
Example 2, a conditional rule that can be undone. Step I: an odd number is doubled and an even number is increased by 1. Step II: the line is reversed. Output: 21 10 13 14. Undo the reversal: 14 13 10 21. Now undo Step I by the parity of each output: an even output came from doubling an odd number, so halve it (14 → 7, 10 → 5); an odd output came from adding 1 to an even number, so subtract 1 (13 → 12, 21 → 20). The input is 7 12 5 20. Forward check: 7 → 14, 12 → 13, 5 → 10, 20 → 21, reversed 21 10 13 14.
Operation-Based Machines
An operation-based machine changes values. The rule can act on every item, on items at chosen positions, or on items that meet a condition. A step may also be a plain rearrangement, so a full question often mixes both kinds.
| Rule | Input and steps | Result |
|---|---|---|
| Positional: interchange first and last, then add 5 to numbers at even places | 12 7 20 9 → 9 7 20 12 → 9 12 20 17 | Then ascending: 9 12 17 20 |
| Conditional: a multiple of 3 is divided by 3, any other number gets 4 added | 15 22 9 40 18 → 5 26 3 44 6 | Descending: 44 26 6 5 3 |
| Grouping: evens first ascending, then odds descending, then subtract 2 at odd places | 23 18 41 6 35 12 → 6 12 18 41 35 23 → 4 12 16 41 33 23 | Sum of last three: 97 |
In a mixed word-number machine the rules name the type. Input tax 47 bond 15 draft 62. Step I: the smallest number goes to the left end. Step II: the word that comes last in the dictionary goes to the right end. Step III: the largest number goes to place 2 from the left. The lines are: Step I 15 tax 47 bond draft 62; Step II 15 47 bond draft 62 tax (tax is last alphabetically); Step III 15 62 47 bond draft tax.
Alphanumeric and Letter-Shift Machines
Some machines work on letters through their positions: A = 1, B = 2, … Z = 26. Two facts are worth memorising. The letter and its mirror letter (A and Z, B and Y) add up to 27. Shifting past Z wraps to A, so with a shift of 2, Y becomes A and Z becomes B.
Example 1, letter sum. Step I: replace each letter of DRAFT by its position and add them: 4 + 18 + 1 + 6 + 20 = 49. Step II: reverse the digits: 94.
Example 2, shift then reverse. Step I: move every letter 2 places forward in the alphabet. Step II: reverse the order of letters. Input LOAN: L → N, O → Q, A → C, N → P, so Step I is NQCP and Step II is PCQN. A trap is to stop at Step I, or to shift backwards (giving JMYL and then LYMJ).
Speed Method and Step Counts
A machine set with a six-item line usually carries four to five questions, so the work done once is reused. Trace the whole machine to its last step on rough paper, then answer every question from that column. Do not trace separately for each question.
| Fact | Statement |
|---|---|
| Maximum steps, selection shift or alternating ends, n items | n − 1 |
| After step k, selection shift | The k smallest (or largest) items stand at places 1 to k in order |
| Which step finally places a given item (alternating ends) | Rank the item: the step number is its place in the order largest, smallest, second largest, second smallest, … |
Worked example. For input 14 63 27 8 41 36 under alternating ends, the lines are 63 14 27 8 41 36; 63 14 27 41 36 8; 63 41 14 27 36 8; 63 41 27 36 14 8; 63 41 36 27 14 8. The last line is the sorted descending order, reached at step V, so n − 1 = 5 steps. The number 36 reaches its final place 3 only in step V, because at step IV it stood at place 4.
(2) Answering for the step before or after the one asked.
(3) Forgetting that the lines are cumulative, so each step starts from the previous output, not from the input.
(4) Applying an operation to the input values after a rearrangement instead of to the new line.
Key takeaways
- Read the rule, number the places from the left, and write each step as a new line built from the line above.
- Selection shift and alternating ends need at most n − 1 steps; the items jumped over keep their order.
- Identify an unknown rule from two steps and test it on the second step against every rival rule.
- To find the input, undo the steps from the last to the first, each by its inverse; use parity of the output for conditional rules.
- Positions in an operation rule refer to the line at that step, not to the input.
- In letter machines A = 1 to Z = 26, mirror letters sum to 27, and a shift wraps from Z to A.
Practice questions (17)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
A machine rearranges a line of numbers in steps. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. Input: 52 17 38 9 24. What is Step III?
Show answer
Answer: C — 9 17 24 52 38
Step I: 9 52 17 38 24. Step II: 9 17 52 38 24. Step III brings 24 to place 3: 9 17 24 52 38. The line 9 17 24 38 52 is Step IV, where 38 is placed; stopping one step late is the tempting error.A machine works in steps on a line of numbers. Step I: the largest number goes to the left end. Step II: the smallest number goes to the right end. Step III: the second largest goes to place 2 from the left. Step IV: the second smallest goes to place 2 from the right. Step V: the third largest goes to place 3 from the left. The other numbers shift but keep their order. Input: 14 63 27 8 41 36. What is Step IV?
Show answer
Answer: D — 63 41 27 36 14 8
Step I: 63 14 27 8 41 36. Step II: 63 14 27 41 36 8. Step III: 63 41 14 27 36 8. Step IV sends 14, the second smallest, to place 2 from the right: 63 41 27 36 14 8. The line 63 41 14 27 36 8 is Step III and 63 41 36 27 14 8 is Step V.A machine works on words by their number of letters. Step I: the longest word goes to the left end. Step II: the shortest word goes to the right end. Step III: the second longest goes to place 2 from the left. The other words shift but keep their order. Input: loan fee interest cheque deposit. What is Step III?
Show answer
Answer: B — interest deposit loan cheque fee
Lengths: interest 8, deposit 7, cheque 6, loan 4, fee 3. Step I: interest loan fee cheque deposit. Step II: interest loan cheque deposit fee. Step III moves deposit to place 2: interest deposit loan cheque fee. The line interest deposit cheque loan fee is Step IV.A machine arranges numbers in steps. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. The machine stops as soon as the numbers are in ascending order. Input: 61 18 45 27 72. In how many steps does it stop?
Show answer
Answer: C — 3
Step I: 18 61 45 27 72. Step II: 18 27 61 45 72. Step III: 18 27 45 61 72, which is ascending, so the machine stops after 3 steps. The answer 4 comes from counting n − 1 for five numbers, but 72 is already in place and the stop rule ends the run earlier.A machine works in two steps on a line of numbers. Step I: an odd number is doubled and an even number is increased by 1. Step II: the order of the line is reversed. The output is 21 10 13 14. What was the input?
Show answer
Answer: A — 7 12 5 20
Undo the reversal: 14 13 10 21. Then undo Step I by parity: even 14 came from odd 7, odd 13 from even 12, even 10 from odd 5, odd 21 from even 20. The input is 7 12 5 20. The line 14 13 10 21 is the result after Step I, and 20 5 12 7 comes from forgetting that the order matters.A machine works in two steps on three numbers. Step I: 4 is added to every number. Step II: every number is doubled. The output is 30 18 40. What was the input?
Show answer
Answer: B — 11 5 16
Undo the last step first: halve to get 15 9 20; then undo Step I by subtracting 4 to get 11 5 16. Forward check: (11 + 4) × 2 = 30, (5 + 4) × 2 = 18, (16 + 4) × 2 = 40. The line 13 7 18 comes from subtracting 4 before halving, which undoes the steps in the wrong order.A machine works in three steps on numbers. Step I: the first and last numbers are interchanged. Step II: every number at an even place from the left is increased by 5. Step III: the numbers are arranged in ascending order. Input: 12 7 20 9. What is the second number from the right in Step III?
Show answer
Answer: D — 17
Step I: 9 7 20 12. Step II adds 5 to places 2 and 4: 9 12 20 17. Step III: 9 12 17 20. The second number from the right is 17. The answer 20 is the first from the right, and 14 would result if places were counted from the right in Step II (9 7 20 12 becomes 14 7 25 12, then 7 12 14 25).A machine works in two steps on numbers. Step I: a multiple of 3 is divided by 3, and every other number has 4 added to it. Step II: the numbers are arranged in descending order. Input: 15 22 9 40 18. What is the sum of the first and fourth numbers of Step II?
Show answer
Answer: A — 49
Step I: 15 → 5, 22 → 26, 9 → 3, 40 → 44, 18 → 6, giving 5 26 3 44 6. Step II in descending order: 44 26 6 5 3. The first and fourth numbers are 44 and 5, so the sum is 49. The value 29 results from reading the line in ascending order (3 and 26).A machine arranges a line of distinct numbers. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. Which of the following is NOT true for a line of 6 distinct numbers?
Show answer
Answer: C — The numbers are always in ascending order only after 6 steps
The maximum is n − 1 = 5 steps, because when 5 places are correct the sixth is forced. So the claim of exactly 6 steps is false (an input that is already sorted needs none). The other three statements are properties of the shift rule.A machine works on a mixed line. Step I: the smallest number goes to the left end. Step II: the word that comes last in dictionary order goes to the right end. Step III: the largest number goes to place 2 from the left. Other items shift but keep their order. Input: tax 47 bond 15 draft 62. What is Step III?
Show answer
Answer: B — 15 62 47 bond draft tax
Step I: 15 tax 47 bond draft 62. Step II: tax is last alphabetically (t after d and b), so 15 47 bond draft 62 tax. Step III puts 62 at place 2: 15 62 47 bond draft tax. Leaving 62 where Step II had it, or sending tax to the end before moving the number, gives the other lines.Input 34 71 18 52 9 63 is changed by a machine. Step I gives 71 34 18 52 9 63 and Step II gives 71 34 18 52 63 9. The machine follows one fixed rule in which the third step brings the second largest number to place 2 from the left, the fourth step sends the second smallest to place 2 from the right, and so on in the same pattern. What is Step III?
Show answer
Answer: D — 71 63 34 18 52 9
The second largest is 63. Bringing it to place 2 from 71 34 18 52 63 9 shifts the numbers it jumps over and gives 71 63 34 18 52 9. The line 71 63 52 34 18 9 is the final sorted line, tempting but not yet reached, and 71 63 34 52 18 9 is Step IV.Input 27 62 9 40 15 becomes 62 27 9 40 15 in Step I and 62 27 40 15 9 in Step II. Which rule produced these two steps?
Show answer
Answer: B — Largest to the left end, then smallest to the right end, rest unchanged
Step I moves 62 to the left end and Step II moves 9 to the right end, which is the alternating-ends rule. The next-largest rule would give 62 40 27 9 15 at Step II, which does not match, and the other two rules fail at Step I.A machine works on a word in two steps. Step I: every letter is moved 2 places forward in the English alphabet. Step II: the order of the letters is reversed. Input: LOAN. What is the output of Step II?
Show answer
Answer: C — PCQN
Step I: L → N, O → Q, A → C, N → P gives NQCP. Reversing gives PCQN. The line NQCP is only Step I, and LYMJ results from moving the letters backwards instead of forwards.A machine works on a word in two steps. Step I: each letter is replaced by its position in the English alphabet (A = 1 to Z = 26) and the positions are added. Step II: the digits of the sum are written in reverse order. Input: DRAFT. What is the output of Step II?
Show answer
Answer: A — 94
D = 4, R = 18, A = 1, F = 6, T = 20 add up to 49 in Step I. Reversing the digits gives 94 in Step II. The value 49 is the Step I result and 13 is the digit sum, a different operation.A machine works in two steps. Step I: the even numbers are placed first in ascending order, followed by the odd numbers in descending order. Step II: every number at an odd place from the left is decreased by 2. Input: 23 18 41 6 35 12. What is the sum of the last three numbers of Step II?
Show answer
Answer: C — 97
Step I: 6 12 18 41 35 23. Step II reduces places 1, 3 and 5 (6, 18, 35) by 2: 4 12 16 41 33 23. The last three are 41, 33 and 23, which add up to 97. The value 99 is the sum before Step II is applied.A machine works on a line of numbers. Step I: the largest goes to the left end. Step II: the smallest goes to the right end. Step III: the second largest goes to place 2 from the left. Step IV: the second smallest goes to place 2 from the right. Step V: the third largest goes to place 3 from the left. Other numbers shift but keep their order. Input: 14 63 27 8 41 36. In which step does 36 reach the place it holds in the final line?
Show answer
Answer: D — Step V
The lines are 63 14 27 8 41 36; 63 14 27 41 36 8; 63 41 14 27 36 8; 63 41 27 36 14 8; 63 41 36 27 14 8. The final line is 63 41 36 27 14 8, so 36 belongs at place 3. It stands at place 5 in Step II, place 5 in Step III and place 4 in Step IV, and reaches place 3 only in Step V.In a machine, one step adds 3 to each number of a line. Consider these statements. P: the step can be undone by subtracting 3 from each number. Q: it can be undone by dividing each number by 3. R: if it is followed by doubling, the pair is undone by halving first and then subtracting 3. S: if it is followed by doubling, the pair is undone by subtracting 3 first and then halving. Which statements are correct?
Show answer
Answer: B — P and R only
Adding 3 is undone by subtracting 3, so P is right and Q is wrong. For add-3-then-double, the last step (doubling) must be undone first by halving, then 3 is subtracted, so R is right. Statement S reverses the correct order: for input 5, the output is 16, halving gives 8 and subtracting 3 gives 5, whereas subtracting first gives 13 and halving gives 6.5.