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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.2: Array Names As Pointers
Problem 2E
icon
Related questions
Question
100%

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.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning