Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 8 of 11

Halve the hunt

Show on a big screen

6 min

Text size

A count of plates is one plate too many. Which line is wrong?

A small example: 16 lines, all in range.
Step 1 of 5
  1. A small example: 16 lines, all in range.
  2. Check the middle: 8 remain.
  3. Check again: 4 remain.
  4. Check again: 2 remain.
  5. One line is left. Found.

Press the button below. Watch the range shrink.

Loading lab…

The rule

In the lab, the wrong line is line 10. You find it in 4 checks, not 10.

Say one line is wrong. Its wrong result stays in the total. Check the middle of what is left. Drop the half that cannot hold the fault. Then check again.

A fault is the mistake that makes the total wrong.

Each line here runs once, in order. None is inside a loop or a call. Halving needs an order to cut. A jumbled row of cards has no order. One check drops nothing.

Work out what the total should be after line 8. Run the first 8 lines. Is it wrong already? Then the fault is in lines 1 to 8. Is it still right? Then it comes later.

Let the fault be on line 10. After line 8 the total is right. So look in lines 9 to 16. After line 12 it is wrong. So look in lines 9 to 12. After line 10 it is wrong. So look in lines 9 and 10. After line 9 it is right. So line 10 is the fault.

Sixteen lines, fault on line 10: halving takes 4 checks. Checking from the top takes 10. A fault on line 1 would take 1 check from the top.

Try the lab to finish this lesson.