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-6
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.
1 Create a class called Intlist. (List of integers)
2. The list class should have an integer array that can contain up to 50 integers
3. The class should have a default constructor, and a constructor that accepts an integer array
of 50 integers.
4. 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 -1 if the key was not found.
5. 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 -1 if the key was not found.
6. 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
1) Create an array storing the following numbers.
12,56,2,4,31,58,23,17,89,44,23,22,89,56,43,25,11,10,9,47,99,101,45,24,57,33,35,78,76,73
,57,55,61,63,34,69,79,89,98,97,96,95,7,27,8,81,99,105,110,3
2) Once you have loaded and integer array with the 50 numbers insatiate a Intlist object with
that array.
3) Do a sequential (linear) search for the following three numbers. 89,24, and 107.
4) 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 ,-1.
5) Your Intlist class should have a method to sort the array. Call the sort method and print
out the sorted array.
6) Do a binary search on the sorted array for the following numbers 89,24, and 107.
7) 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 ,-1

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 Programming Questions!