RG's E-Learning Centre · Book a free demo class · WhatsApp +91-9379416374

Linear search comparisons: Class 11 practice

Linear search checks elements one by one from the start. Read the method, follow the three worked examples, then try the six questions.

What you should know first

  • Lists

The idea behind linear search comparisons

Linear search checks elements one by one from the start. Finding the item at position k (1-based) takes k comparisons; an absent item takes n comparisons.

Step-by-step method

  1. Start at index 0.
  2. Compare each element with the target.
  3. Stop when found or at the end of the list.

Worked example 1 (Basic)

Linear search for 28 in [12, 80, 44, 28, 14, 51, 17, 68]. How many comparisons are made?

  1. First match at index 3
  2. 4 comparisons
  3. Answer: 4

Worked example 2 (Standard)

Linear search for 54 in [22, 52, 13, 29, 55, 40, 23, 54, 23, 59]. How many comparisons are made?

  1. First match at index 7
  2. 8 comparisons
  3. Answer: 8

Worked example 3 (Challenge)

Linear search for 41 in [41, 70, 23, 71, 26, 52, 84, 44, 46, 91, 52, 39]. How many comparisons are made?

  1. First match at index 0
  2. 1 comparisons
  3. Answer: 1

Common mistakes and misconceptions

  • Counting from 0 when asked for the number of comparisons
  • Stopping early for an absent item

Practice questions

  1. (Basic) Linear search for 46 in [46, 31, 93, 18, 54, 73, 31, 53]. How many comparisons are made?
  2. (Basic) Linear search for 20 in [30, 20, 93, 26, 54, 81, 96, 55]. How many comparisons are made?
  3. (Standard) Linear search for 32 in [35, 45, 40, 25, 73, 71, 16, 33, 32, 50]. How many comparisons are made?
  4. (Standard) Linear search for 89 in [15, 22, 89, 63, 68, 37, 63, 38, 81, 88]. How many comparisons are made?
  5. (Challenge) Linear search for 94 in [94, 32, 37, 20, 94, 37, 28, 82, 76, 20, 45, 41]. How many comparisons are made?
  6. (Challenge) Linear search for 45 in [61, 73, 45, 97, 44, 13, 91, 29, 23, 66, 53, 29]. How many comparisons are made?

Answer key with full working

  • Q1: First match at index 0 → 1 comparisons → Answer: 1
  • Q2: First match at index 1 → 2 comparisons → Answer: 2
  • Q3: First match at index 8 → 9 comparisons → Answer: 9
  • Q4: First match at index 2 → 3 comparisons → Answer: 3
  • Q5: First match at index 0 → 1 comparisons → Answer: 1
  • Q6: First match at index 2 → 3 comparisons → Answer: 3

Syllabus note

This skill is listed under "Searching" for Class 11 in the NCERT/CBSE books. ICSE, IGCSE, IB and state boards may teach it in a different chapter or year.

Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.

Related practice and notes

Frequently asked questions

Which chapter is linear search comparisons in?

"Searching", Class 11 Computer Science (NCERT/CBSE). Other boards may place it differently.

How were the answers checked?

Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.

Book a free demo class