Skip to content

Linear search

finding

Level 1 of 3

Also called Sequential search.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from linear search's own run on the numbers shown.

choose one

question 1

Linear search looks for 12 in 63, 1, 12, 12, 67. At which place does it stop?

631121267
the answer, and why

the answer is C

It looks at each number from place 1 until 12 at place 3, which is the number wanted. It stops there.

if you chose another

  • That is the second 12. The search stops at the first.
  • Place 1 holds 63, which is not 12.
  • Place 5 is reached only when the number is not there, or stands last. Here it stands at place 3.

new numbersthe test page's numbers

question 2

How many looks does linear search take to learn that 66 is not in 23, 16, 50, 38, 36, 67, 4?

2316503836674
the answer, and why

the answer is B

66 is not there, so every one of the 7 numbers is looked at, once each.

if you chose another

  • One look finds a number only when it stands first.
  • That is the average for a number that is there, (7 + 1) over 2.
  • There is no place 8. The search stops after place 7.

new numbersthe test page's numbers

question 3

Which search costs linear search the fewest looks? Each option is a row, then, after the semicolon, the number wanted.

the answer, and why

the answer is A

Linear search takes 1 look for 12, 38, 58, 52, 68; 12, the fewest of the four.

if you chose another

  • Linear search takes 5 looks for this one, more than 1.
  • Linear search takes 2 looks for this one, more than 1.
  • Linear search takes 3 looks for this one, more than 1.

new numbersthe test page's numbers