Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will also implement what you believe to be the least efficient sort & search algorithm combination for this problem, but comment it out,

image text in transcribed image text in transcribed 

You will also implement what you believe to be the least efficient sort & search algorithm combination for this problem, but comment it out, leaving a note as to why you think this would be the worst option. AllSorts.java A briefing the 3 files: This file can be found on blackboard and is complete. No need to make any changes. The file consists of all sorting algorithms we covered in class, each in their own method of type int[]. Later, in the assignment you will create an object of this class and use the appropriate sort method when needed. AllSearch.java This file can be found on blackboard and is complete. No need to make any changes. The file consists of all searching algorithms we covered in class, each in their own method of type int. Later, in the assignment you will create an object of this class and use the appropriate search method when needed. SortSearchAssign .java This file is your starting point, you begin with an empty main and one completed method createFile() the rest is up to you. More detailed instructions, Some pseudocode & Example output, Next Page First, be sure you review all 3 files and understand the code that is written for you. Remember, AllSorts & AllSearch are finished. SortSearcAssign_ currently, consists of one method createFile() which generates a .txt file of 1,000,000 numbers to your default location (src). Below is loose pseudocode to ONE approach you may take to solve this problem, remember, you DO NOT HAVE TO FOLLOW THESE INTRUCTIONS, you can come up with your own solution: 1. Your main method should call createFile() and ensure the file is created successfully (it will re-generate each time you run). 2. You now have to figure out how to bring the numbers from the .txt file into an int array. I would suggest creating another method such as: a. Public static int[] getArray() This method would create an array of size 1 Million (since we know the file contains this many numbers) try to read the text file and while there is something to read, store that something into the current index of the array (you may need a counting variable to keep track of this) *Another issue you may encounter is that anything reading from a .txt file is a String. More specifically, our text file contains "," and "" characters so you must remove these. I suggest using the .substring() method of the String class paired with .indexOf() you may need research how these methods work and can be applied in this situation. Once this is complete you should be able to assign the count position of the array to a the Integer.pasrelnt() version of our text variable. Once completed, create an array in the main and assign to this method call. 3. Back in the main method, you are to create two objects one for each class provided to you (AllSorts & AllSearch). Having an object for each of these classes will allow you to leverage all the sort & search algorithms we have learned. 4. You've done all the hard work! Now it's time for some testing. Using your newly created array & objects, try various combinations of sorting & searching algorithms to locate a number of your choosing within the array. Any combination that produces the end result in less than 1 second is what we are looking for. (See image on next page) Remember, if these more detailed instructions are too much / overwhelming refer to the brief overview (in purple) on page 1, You just have produce the end-result, you are NOT required to follow my instructions exactly. Creativity is encouraged.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here is one way to implement the least efficient sort and search algorithm combination for this prob... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Management Science

Authors: Bernard W. Taylor

11th Edition

132751917, 978-0132751919

More Books

Students also viewed these Finance questions

Question

Required quality and reliability of the system to be built

Answered: 1 week ago