Question DSA-SRCH-0021
EasyLinear search looks for 15 in [4, 8, 15, 16]. How many comparisons are made?
- A.
1
- B.
3
- C.
Show answer and explanation
Answer: B
It compares with 4, 8 and then 15, where it stops.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Searching and Binary Search question
Linear search looks for 15 in [4, 8, 15, 16]. How many comparisons are made?
1
3
Answer: B
It compares with 4, 8 and then 15, where it stops.
2
4