Question: 4. Write a C program in which an integer type of array named numbers with size of 20 is defined and each elements in the



4. Write a C program in which an integer type of array named numbers with size of 20 is defined and each elements in the array are determined as multiple of 3 times the index of the element (for example numbers[0] and numbers[5] will be 0 and 25 respectively). The program will search through the array elements for a desired value given by the user. Searching through the array will be done by two separate functions named l_search and b_search (I_search uses linear search algorithm and b_search uses binary search algorithm). Both of the functions return the index of the element holding the search key or -1 if the search key cannot be found within the array. Array: 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 Please Enter the Search Key: 27 Linear Search Result: 27 is found in the element with index 9 Binary Search Result: 27 is found in the element with index 9 If the value can't be found, then the program informs the user that the ... cannot be found. You should clearly define the prototypes of the l_search and b_search functions at the beginning of the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
