198,095 views
22 votes
22 votes
You have an unsorted array of 1,000,000

people.
You are using a Linear Search to look for
someone who is not in the array at all.
How many people does the computer look at
before it realizes this person is not in the array?
O a
b
Ос
Od
(a)exactly 1
(b)about 500,000
(c)all 1,000,000
(d) it will search forever
(d)It will search forever.

User Alexandros
by
2.6k points

2 Answers

19 votes
19 votes

Final answer:

In a Linear Search on an unsorted array of 1,000,000 people, if the person is not present, the computer will check all 1,000,000 entries to conclude the person is not there.

Step-by-step explanation:

When using Linear Search to find an individual in an unsorted array and the person is not present, the computer will look through each entry in the array sequentially until it reaches the end. Since the individual is not in the array, the computer will have to check all 1,000,000 entries before coming to a conclusion that the person is not present in the array. Thus, the correct answer to the question is (c) all 1,000,000 people before it realizes this person is not in the array.

User Francesc Rosas
by
2.8k points
8 votes
8 votes
I’m pretty sure it’s C.
User Nepthar
by
2.6k points