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 62 in 6, 62, 16, 62, 84. At which place does it stop?

662166284
the answer, and why

the answer is A

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

if you chose another

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

new numbersthe test page's numbers

question 2

How many looks does linear search take to learn that 11 is not in 1, 24, 99, 94, 69, 60, 6?

124999469606
the answer, and why

the answer is C

11 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 47, 19, 70, 40, 20; 47, the fewest of the four.

if you chose another

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

new numbersthe test page's numbers