(Linear search) Rewrite the linear search function in Listing, LinearSearch.cpp, to use a generic type for array elements. Test the function with array of int , double , and string values.
LISTING LinearSearch.cpp
int linearSearch(const int list[], int key, int arraySize){ for (int i = 0 ; i < arraySize; i++) { if (key == list[i]) return i; } return −1;}

Please trace the function using the following statements:
int list[] = {1 , 4 , 4 , 2 , 5 , −3 , 6 , 2 };int i = linearSearch(list, 4 , 8); // Returns 1 int j = linearSearch(list, −4 , 8); // Returns −1 int k = linearSearch(list, −3 , 8); // Returns 5
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.