0
/ 10
Consider a linear search as shown below.
int linearSearch(int w, int[] num) { // linear search code here }
Assume you call this method...
Consider a linear search as shown below.
int linearSearch(int w, int[] num)
{
// linear search code here
}
Assume you call this method with an unsorted array with n elements for argument num
.
What is the minimum and maximum number of comparisons made to search for w
on any given call?
int numbers[] = {10, 3, 9, ..., 5, 25};
linearSearch(__, numbers);
Consider number of comparisons for edge cases, that is cases where it never finds the value as well as cases where it finds it as fast as possible.
Your feedback will appear here when you check your answer.