Question: Rewrite the binary search function, BinarySearch.cpp, to use a generic type for array elements. Test the function with array of int, double, and string values.
Rewrite the binary search function, BinarySearch.cpp, to use a generic type for array elements. Test the function with array of int, double, and string values. 
1 int binary Search const int list0, int key, int listsize) 2 int low 4 int high listSize 1; while Chigh OW 8 int mid (low high) 2; if (key list[mid]) 10 high mid 1; else if (key list[mid]) 11 return mid 12 13 else 14 low mid 1 15 16 17 return -low 1; 18
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
