asked 93.4k views
4 votes
What is the worst case running time of a linear search?

O(1)

O(log10N)

O(log2N)

O(log2N)

O(N)

O(N log N)

O(N2)

O(N3)

O(Nk)

O(2N)

O(N!)

asked
User Dvvrd
by
8.0k points

2 Answers

4 votes

Answer:

o(n)

Step-by-step explanation:

answered
User Ahmad Vatani
by
8.1k points
6 votes

Answer:

The worst case running time of a linear search is O(N).

Step-by-step explanation:

In a linear search, you will run the program looking at each array position until you find your desired information.

The best case scenario is when you find it at the first position.

The worst case scenario is when you find the value at the last array position. So, in a N-length array, the information is at position N. This means that the worst case running time of a linear search is O(N).

answered
User The Zero
by
7.4k points