AThe first look is always at a block's end, so even the first number costs 2.
BOn 2 numbers it can make 3 looks, linear search at most 2.
DOn 10 numbers the last costs 5, but place 9 costs 6.
pen and paper
5question 5about 8 minutes
Jump search runs on the 7 numbers 8, 19, 27, 33, 46, 54, 62.
Find the block size and the blocks.
Count the looks for 54 and for 62.
Say why no number of the row costs more.
a hint
The block is the square root of 7, rounded down. A place costs its block's number plus its place in the block.
a worked answer
The root of 7 is about 2.65, so blocks of 2: places 1 and 2, 3 and 4, 5 and 6, and 7 alone. 54 is place 2 of block 3, 3 + 2 = 5 looks. 62 is place 1 of block 4, 4 + 1 = 5 too. The whole blocks are 3, and 3 + 2 = 5 is the most, by the steps below.
place
number
block
place in the block
looks
1
8
1
1
2
2
19
1
2
3
3
27
2
1
3
4
33
2
2
4
5
46
3
1
4
6
54
3
2
5
7
62
4
1
5
Every place's cost, its block plus its place in the block. The most, 5, is at places 6 and 7.
Which number costs the most looks, and how fast does that most grow?12 of 12 shown
1the move: name the block
the line:
why it is allowed: is the block's size, the square root of rounded down. The root of 10 is about 3.16, so 10 numbers make blocks of 3.
2the move: price one place
the line:
looks for the number at each place, 10 numbers
Each place's cost on 10 numbers, 2, 3, 4, then 3, 4, 5, then 4, 5, 6, then 5. The top is place 9.
why it is allowed: To reach block , the search looks at block ends, the last not smaller. The walk then looks at places. In section 3's picture, 70 is place 3 of block 3, so 6 looks, and 84 place 1 of block 4, so 5.
guess it, then
3the move: find the costliest
the line:
place
block,
place in the block,
looks,
7
3
1
3 + 1 = 4
8
3
2
3 + 2 = 5
9
3
3
3 + 3 = 6
10
4
1
4 + 1 = 5
The last four places of section 3's row of 10.
why it is allowed: The whole blocks are over , rounded down: 3 for 10. In a whole block, is at most that and at most , both at its last place. A short last block has one more but one less at least, so it never costs more. On 10 numbers, the short block's one place costs 4 + 1, less than 3 + 3.
guess it, then
4the move: count it
the line:
why it is allowed: is the most looks for a number in the row. By line 3, is the whole blocks and is . For 10, 3 + 3 = 6.
guess it, then
5the move: at most two blocks past m
the line:
4 times 4 is 16, cut into 3 times 3, two strips of 3 and a corner of 1. Without the corner, 15 is 5 blocks of 3.
the longest row with blocks of
whole blocks
1
3
3
3
2
8
4
4
3
15
5
5
4
24
6
6
Just under each next square, the whole blocks reach , and no row has more.
why it is allowed: Take of 3: rows of 9 to 15 numbers. The next square is 4 times 4, 16, and 15 is 5 blocks of 3. In general, the root of is under , as is the root rounded down, and rounding down takes off less than 1. So is under the next square, times . As the picture shows, that square is times , two strips of and a corner of 1. So is at most blocks of , and the most is the whole blocks, at most, plus the walk's .
guess it, then
6the move: m is at most the root
the line:
why it is allowed: is rounded down, so at most . For 10, 2 times 3.16, plus 2, is about 8.3, over 6.
guess it, then
7the move: read it as a bound
the line:
why it is allowed: By line 6. From 1 number on, 2 is at most 2 times , so is at most 4 times .
guess it, then
8the move: at least m whole blocks
the line:
why it is allowed: By lines 1 and 4. is at most the root of , so times is at most , at least whole blocks. For 10, 3 times 3 is 9, so 3 + 3.
guess it, then
9the move: m is at least 1
the line:
why it is allowed: Every block holds 1 number at least.
guess it, then
10the move: rounded down, plus 1, passes the root
the line:
why it is allowed: Rounding down takes off less than 1, so is more than . For 10, 4 is more than 3.16.
guess it, then
11the move: read it as a bound
the line:
why it is allowed: By line 10, 1 times at least, from 1 number on.
guess it, then
12the move: ceiling and floor together
the line:
why it is allowed: Lines 7 and 11 bound by the same growth, .
guess it, then
try it with a small : at , line 4 gives , which you can work out by hand
The whole blocks plus , 3 + 2, is the most, by the steps below.
6question 6about 6 minutes
A tape holds 144 numbers in order, read only from the front. Each place is as likely to hold the number wanted.
About how many looks does jump search average?
At most how many does it make?
If any place could be read at once, at most how many would binary search make?
a hint
144 is 12 times 12, a square row.
a worked answer
Blocks of 12, a square row, so by section 4's question on a square row the average is , 13 looks. By the question on the most looks, the most is 144 over 12, plus 12, which is 24. 2 to the power 7 is 128 and to the power 8 is 256, so is 7 for 144. By the question on binary search, it makes 8 at most. On tape it cannot jump to the middle, so jump search it is.
what
how many
jump search, on average
13 looks
jump search, at most
24 looks
2 to the power 7, and 8
128 and 256
binary search, at most
8 looks
144 numbers on tape, and as if any place could be read.
On a square row, times numbers, what is the average exactly?7 of 7 shown
1the move: price one place
the line:
block
place 1
place 2
place 3
in all
1
2
3
4
9
2
3
4
5
12
3
4
5
6
15
in all
36
Each cell is its block's number plus its place in the block. 36 looks over 9 places is 4.
why it is allowed: By line 2 of the question on the most looks. On section 1's 9 numbers, in blocks of 3, every place's cost is in the table.
2the move: average every place
the line:
why it is allowed: is the average over the times places, each as likely. For 3, 36 over 9 is 4.
guess it, then
3the move: split the block numbers from the places
the line:
block
block numbers
places in the block
in all
1
1 + 1 + 1 = 3
1 + 2 + 3 = 6
9
2
2 + 2 + 2 = 6
1 + 2 + 3 = 6
12
3
3 + 3 + 3 = 9
1 + 2 + 3 = 6
15
in all
18
18
36
The table of costs split in two. Its block numbers add to 18, its places to 18, and 18 + 18 = 36.
why it is allowed: Each block's number stands in cells of the table, and each place in the block in cells too, as the picture splits them. For 3, 3 times 6, plus 3 times 6, is 36, and 36 over 9 is 4.
guess it, then
4the move: share out 1 over m squared
the line:
why it is allowed: over is 1 over . For 3, 6 over 3, twice.
guess it, then
5the move: use the page on expected cost
the line:
where does this come from?
question 1 of the page expected costPick a whole number from 1 to , each as likely. What is its expected value?
1the move: each value times its chance
the line:
times its chance
1
1 over 5
2
2 over 5
3
3 over 5
4
4 over 5
5
5 over 5
in all
15 over 5, which is 3
For 5, each number times its chance, 1 over 5.
why it is allowed: The expected value adds each number times its chance, 1 over ., read the sum of, adds the term after it for each from the value under it to the value over it.
2the move: take the chance out in front
the line:
why it is allowed: Each term is multiplied by 1 over , so multiply once, after adding. For 5, 1 over 5 times 15.
3the move: use the page on adding up
the line:
where does this come from?
question 1 of the page adding up Fit two staircases of squares together. What shape do they make?
1the move: draw the sum as a staircase
the line:
why it is allowed: Let be the sum of the whole numbers from 1 to . Draw it as a staircase, a column for each number: 1 square, then 2, and so on up to . For 5, columns of 1, 2, 3, 4 and 5 hold 15 squares.
2the move: take two staircases
the line:
why it is allowed: Two staircases hold twice the squares. Doubling both sides of line 1 keeps it true.
3the move: fit them into a rectangle
the line:
Blue stands, yellow hangs. Two staircases of 1 to 5 squares fill a rectangle 5 wide and 6 tall, 30 squares. So 1 + 2 + 3 + 4 + 5 is 5 times 6, halved, which is 15.
why it is allowed: Stand one staircase with its tallest column on the left. Hang the other upside down from the top, its tallest column on the right, as in the picture. The first column holds standing and 1 hanging. Each column to the right, the standing one loses a square and the hanging one gains one. So every column holds , and the columns fill a rectangle wide and tall.
4the move: halve both sides
the line:
why it is allowed: Halving both sides of line 3 keeps it true and leaves one . For 5, half of 30 is 15.
why it is allowed: The whole numbers from 1 to add up to times one more than , halved, as the page on adding up 1 to works out. For 5, 5 times 6, halved, is 15.
4the move: cancel the n
the line:
why it is allowed: on top and underneath cancel, as is not zero. For 5, 6 over 2 is 3.
5the move: read it
the line:
why it is allowed: By line 4, halfway between the smallest number, 1, and the biggest, : 3 for 5.
why it is allowed: The box under this line works out the average of a number from 1 to its , each as likely, as one more than it, halved. Here, with in place of its , twice, for the block reached and for the place in it. For 3, 2 and 2.
guess it, then
6the move: add
the line:
why it is allowed: Two halves of . For 3, 4.
guess it, then
7the move: m is the root of the row's length
the line:
why it is allowed: The row holds , times , numbers, so is . For 9, 3 + 1 = 4, as section 3's table counts.
guess it, then
try it with a small : at , line 2 gives , which you can work out by hand