Question: Programming Project - 6 In this project you will be searching a list using a linear search and a binary search. Since a binary search
Programming Project
In this project you will be searching a list using a linear search and a binary search. Since a binary search is being done you will also be doing a sort.
Write a Java program that does the following.
Create a class called Intlist. List of integers
The list class should have an integer array that can contain up to integers
The class should have a default constructor, and a constructor that accepts an integer array
of integers.
The class should have a method to do a sequential search for a specific key value and return
the index of the array position where the key was found or if the key was not found.
The class should have a method to do a binary search for a specific key value and return the
index of the array position where the key was found or if the key was not found.
The class should have sorting method to sort the original input array. I recommend the class
keep the original input array and the sorted version of the array in a different array, that way
you can print array in its original order or its sorted order.
Main program
Create an array storing the following numbers.
Once you have loaded and integer array with the numbers insatiate a Intlist object with
that array.
Do a sequential linear search for the following three numbers. and
Each search should return the statement is at index index
number In the case where the searched for number is not in the list, the output should
read not found
Your Intlist class should have a method to sort the array. Call the sort method and print
out the sorted array.
Do a binary search on the sorted array for the following numbers and
Each search should return the statement is at index index
number In the case where the searched for number is not in the list, the output should
read not found
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
