Question: Goodnight I need help with this assignment: 1.Build three search algorithms to find matching names in two different lists in JAVA 2.Read two input files,

Goodnight I need help with this assignment:

1.Build three search algorithms to find matching names in two different lists in JAVA

2.Read two input files, each containing a sorted list of first names. Assume the input files will be in the working directory and will be named list1.txt and list2.txt.

Find the matching names using three different algorithms. The first list could be considered the reference list, and the second list would contain the list of names to be found.

(a) The first search method, named findByBruteForce should use a linear search of the target list. The inputs to this function will be the two lists.

(b) The second search method, named findByBinarySearch should implement a binary search algorithm. The inputs to this function will be the two lists.

(c) The third search method, named findByFinesse should implement the tokenized search discussed in class and summarized below.

Start two markers, one for each list, at the beginning of each list. Repeat the process outlined below

Compare the two marked items

If both are equal print the name and advance both markers one element.

else since theyre not equal advance the marker that comes first, alpha- betically.

3. Testing

There are three files supplied with the assignment:

list1.txt which contains the list of five names.

Akira

Bart

Chase

Declan

Duffman

list2.txt also contains a list of five names.

Atkins Blinky Carl 

Duffman

Lisa

expectedOutput.txt which is a redirection of the output. This is to be used as the baseline for running the diff command to confirm the output results and formatting. (See the Sample Output below for an example of how diff will be used.)

Sample output

ff210377@eustis:~/COP3503$ java Lab01 list1.txt contains: Akira Bart 
Chase Declan Duffman 
list2.txt contains: Atkins Blinky Carl 

Duffman

Lisa

The method findByBruteForce found the following match(es): Duffman 
The method findByBinarySearch found the following match(es): Duffman 
The method FindByFinesse found the following match(es): Duffman 
ff210377@eustis:~/COP3503$ java Lab01 >myOutput.txt ff210377@eustis:~/COP3503$ diff myOutput.txt expectedOutput.txt mi113345@eustis:~/COP3503$ 

Note The diff command will report any differences between the input files. No output means there is no differences between the input files.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!