Question: Consider the following description of an algorithm: Given a list of n integers and 3 target integers, a, b, and c: First, perform linear search

Consider the following description of an algorithm: Given a list of n integers and 3 target integers, a, b, and c: First, perform linear search for element a; if it is found, return its index, otherwise continue. Next, perform linear search for element b; if it is found, return its index, otherwise continue. Last, perform linear search for element c; if it is found, return its index, otherwise return -1. What is the best big O estimate of the algorithm runtime?

O(3n)

O(n)

O(n3)

O(3n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!