Question: Write a generic Insertion sort method that restricts the generic type to classes that implement the Comparable interface for the generic type. The method should
Write a generic Insertion sort method that restricts the generic type to classes that implement the Comparable interface for the generic type. The method should have one parameter, the array to be sorted, whose type is the generic type.
Write a generic binary search method that restricts the generic type to classes that implement the Comparable interface for the generic type. The method should have two parameters, the array to be searched and the item to be searched for, both should be of the generic type. The method should return the index of the target value if found or -1 if target is not found.
Create a class that will hold a name and the statistical information associated with that name. The class must also implement the Comparable interface. The comparison should primarily be based on the names.
Write a program which reads the information in the file and stores it into an array of objects of the type you created. (Another place to use split method.) (There are 101,335 names in the file). Sort the array using your insertion sort method. (Note: the insertions sort may take a few minutes to sort this list, depending on the speed of the computer you are using.) Allow a user to enter names and have the program search the sorted array for the names using your binary search method. Use the console for I/O, not GUI. When a name is found, the program should display the name and all other information about the name (labeled/explained appropriately), and the index of the name in the sorted array. If a name is not found, a message should be displayed indicating the name is not listed. Note: Some names may appear twice in the file, once for females and another time for males. Make sure your program handles that in some way so both occurrence can be found. Also, user should be able to use any combination of upper and lower case letters in the name.
Execution must include a display of the first 10 items in the array AFTER it is sorted and must include at least 5 names found and at least 2 names not found.
Can someone help me out here?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
