subject

In computer science, it is often very important to be able to locate a specific data item inside a list or collection of data. algorithms that perform this function are called searching algorithms, and there are many such algorithms in computer science.

although it is inefficient, one of the most common searching algorithms is called linear search. in linear search we have a set of data that serves as the standard, usually stored within an array, and a separate value that we are searching for within that data set. we’d like to know whether the value is within the data set, so we scan through the data set looking for it, one element at a time, starting at the beginning of the array and proceeding, if necessary, to the very last element. if the value is found within the standard array, we return a number indicating its index position within the array. if the value is not found, we return an error indicator, oftentimes a -1, that indicates the value was not in the data set.

for this problem, implement a linear search algorithm that performs this function. you will be given two input files, "lsstandard. txt" and "lstest. txt". the lsstandard. txt file contains integer values against which we are searching. (there will be no more than 100 of these.) the lstest. txt file contains a set of numbers that we are trying to locate within the standard data set. (there will be no more than 50 of these.) read both of these into separate arrays and then determine which of the numbers in the lstest file are included in the lsstandard data set by using a linear search algorithm. have your program print out a report (to the console only is sufficient) that indicates whether the number was found or not.

your output should look something like:
number 1 ( 34) was located at index 15.
number 2 ( 74) was not in the file.
number 3 ( 56) was not in the file.
number 4 (103) was located at index 75. etc.
note that the number for which we searched is indicated in parenthesis in the report. the "index" number refers to the index of the element within the lsstandard data.
your function header for the linear search function should look like: int searchlist(int stdlist [], int numelems, int value)
you’ll notice that this function accepts an array as input parameter. that array, called "stdlist" in the parameter list, will be the array that contains the standard data set. the parameter "numelems" is the number of elements in that array, and the parameter "value" is the element that we are searching for.
your function should search for "value" within the "stdlist" array and return one of two answers: (a) a -1 if "value" is not in "stdlist", or (b) the index position of "value" within "stdlist" if "value" is in "stdlist". (this should be a number between 0 and (numelems- your program should then use that result to determine what should be printed in the report

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
question
Computers and Technology, 24.06.2019 07:30
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
You know the right answer?
In computer science, it is often very important to be able to locate a specific data item inside a l...
Questions
Questions on the website: 13722360