In C programming Language: use the correct program and function descriptions. use a user defined function for the sequential search and it must use pointers to keep track of the number of successful searches as well as how many test comparisons were made. use the srand() function and offset and range correctly. create and use arrays. to search an array using a sequential search. to use sound programming practices. use of a function and pointers. You are tasked to create a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Array may contain duplicate values. Your program will then randomly generate a search target/value in the same range of 1 to 200 and perform a sequential search on the array of stored random values 100 times. Your program should print out the following statistics: The number of successful searches ( a match was found). The number of failed searches. (no match was found in the array) The average number of tests (test comparisons) per search*. If a match is found at index 50 then 51 tests were done for that search. If no match was found then all 100 elements were tested. total comparisons / 100 searches = average number of tests per search. During a search of the array each item will be tested if it is a match, you must keep count of how many tests are performed for each search to compute the average number of tests per search. The program should load an array with 100 numbers from 1 to 200 and then randomly generate a search term and search it 100 times (with 100 different search terms) while keeping track of statistics.
In C programming Language:
- use the correct program and function descriptions.
- use a user defined function for the sequential search and it must use pointers to keep track of the number of successful searches as well as how many test comparisons were made.
- use the srand() function and offset and range correctly.
- create and use arrays.
- to search an array using a sequential search.
- to use sound programming practices.
- use of a function and pointers.
You are tasked to create a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Array may contain duplicate values. Your program will then randomly generate a search target/value in the same range of 1 to 200 and perform a sequential search on the array of stored random values 100 times. Your program should print out the following statistics:
- The number of successful searches ( a match was found).
- The number of failed searches. (no match was found in the array)
- The average number of tests (test comparisons) per search*. If a match is found at index 50 then 51 tests were done for that search. If no match was found then all 100 elements were tested. total comparisons / 100 searches = average number of tests per search.
During a search of the array each item will be tested if it is a match, you must keep count of how many tests are performed for each search to compute the average number of tests per search.
The program should load an array with 100 numbers from 1 to 200 and then randomly generate a search term and search it 100 times (with 100 different search terms) while keeping track of statistics.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images