Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement the following three algorithms presented in the class of the week February 14 and the class of February 21: Selection sort (recursive) Insertion sort

implement the following three algorithms presented in the class of the week February 14 and the class of February 21:

Selection sort (recursive)

Insertion sort (non-recursive)

Merge sort (recursive)

and do the following with the implementations:

Create an array of size 25 and fill it with the values from 25 to 1 in the following way: on the first position you will have the value 25, on the second position you have the value 24, on the next position you have 23 and so on until the last slot in the array contains the value 1.

Run a statement like the following to "sort" the array that is containing the values in the decreasing order:

long startTime = System.currentTimeMillis(); methodA(25); long endTime = System.currentTimeMillis(); System.out.println("That method A for 25 took " + (endTime - startTime) + " milliseconds");

Do the same for methods B and C.

Give the time needed for each of the three sorting implementations

Then go ahead and run the same with an array of 10,000,000 elements still arranged from the largest value 10,000,000 through 1 and submit also the output in miliseconds.

Your submission for part a should be the java file/files for solving the problem, an actual list of the running times for all the 3*2 possibilities (3 algorithm*2 imputs each)

If an algorithm (of the three that you have to implement, or two or all) does not finish in a "reasonable" time, say 45 minutes for the highest value required for this assignment stop the execution and mention that the algorithm did not finish in a reasonable time. Before doing so make sure that you test and debug your implementation properly and make sure there are no bugs and you implemented correctly the algorithm.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago