Objectives: Demonstrate the ability to create and use arrays. • Demonstrate the ability to search an array using a sequential search. • Demonstrate the ability to use sound programming practices. • Demonstrate the use of a function and pointers. Demonstrate the ability to use the Linux server. Problem Description: You are tasked with creating a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Your 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. Summary, your 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.
Objectives: Demonstrate the ability to create and use arrays. • Demonstrate the ability to search an array using a sequential search. • Demonstrate the ability to use sound programming practices. • Demonstrate the use of a function and pointers. Demonstrate the ability to use the Linux server. Problem Description: You are tasked with creating a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Your 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. Summary, your 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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
In C language please;
Requirements:
- You must use the correct program and function descriptions.
- You must 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.
- You must use the srand() function and offset and range correctly.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education