List: the range of this search.
key: what you want to find.
key index: the index of the value 'key' in the list
(possibly) Guesses: how many steps used before you find 'key'.
Any other variables are intermediate variables.
Loop # | index | item | greater? | lo | hi | Key Index |
1 | 9 | 200 | 1 | 1 | 8 | 0 |
2 | 5 | 88 | 1 | 1 | 4 | 0 |
3 | 3 | 28 | 0 | 1 | 4 | 3 |
4 | ||||||
5 |
Loop # | index | item | greater? | lo | hi | Key Index |
1 | 9 | 200 | 0 | 10 | 16 | 0 |
2 | 13 | 280 | 1 | 10 | 12 | 0 |
3 | 11 | 211 | 1 | 10 | 10 | 0 |
4 | 10 | 210 | 0 | 10 | 10 | 10 |
5 |
Loop # | index | item | greater? | lo | hi | Key Index |
1 | 9 | 200 | 0 | 10 | 16 | 0 |
2 | 13 | 280 | 0 | 14 | 16 | 0 |
3 | 15 | 364 | 0 | 14 | 16 | 15 |
4 | ||||||
5 |
Loop # | index | item | greater? | lo | hi | Key Index |
1 | 9 | 200 | 0 | 10 | 16 | 0 |
2 | 13 | 280 | 0 | 14 | 16 | 0 |
3 | 15 | 364 | 1 | 14 | 14 | 0 |
4 | 14 | 316 | 1 | 14 | 13 | 0 |
5 |
The program stops here, nothing found.
Access | Page 1 Initial: B | Page 2 Initial: C | Page 3 Initial: A | Page 4 Initial: D | Hit or Miss? |
A | B | C | A | D | H |
B | B | C | A | D | H |
C | B | C | A | D | H |
D | B | C | A | D | H |
B | B | C | A | D | H |
C | B | C | A | D | H |
D | B | C | A | D | H |
E | B | C | E | D | M |
B | B | C | E | D | H |
C | B | C | E | D | H |
D | B | C | E | D | H |
E | B | C | E | D | H |
F | F | C | E | D | M |
E | F | C | E | D | H |
F | F | C | E | D | H |
C | F | C | E | D | H |
A | F | C | A | D | M |
D | F | C | A | D | H |
C | F | C | A | D | H |
B | B | C | A | D | M |
Access | Page 1 Initial: B | Page 2 Initial: C | Page 3 Initial: A | Page 4 Initial: D | Hit or Miss? |
A | B | C | A | D | H |
B | B | C | A | D | H |
C | B | C | A | D | H |
D | B | C | A | D | H |
B | B | C | A | D | H |
C | B | C | A | D | H |
D | B | C | A | D | H |
E | B | C | E | D | M |
B | B | C | E | D | H |
C | B | C | E | D | H |
D | B | C | E | D | H |
E | B | C | E | D | H |
F | F | C | E | D | M |
E | F | C | E | D | H |
F | F | C | E | D | H |
C | F | C | E | D | H |
A | F | C | E | A | M |
D | F | C | D | A | M |
C | F | C | D | A | H |
B | B | C | D | A | M |