Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In bubbleSort.java rewrite main() so it creates a large array and fills that array with data. You can use the following code to generate random

In bubbleSort.java rewrite main() so it creates a large array and fills that array with data. You can use the following code to generate random numbers:

for(int j = 0; j < maxSize; j++)

{ long n = (long)( java.lang.Math.random()*(maxSize-1) );

arr.insert(n); }

Try inserting 10,000 items. Display the data before andafter the sort. You'll see that scrolling the display takes a long time. Comment out the calls to display() so you can see how long the sort itself takes. The time will vary on different machines. Sorting 100,000 numbers will probably take less than 30 seconds pick an array size that takes about this long and time it. Then use the same array size to time selectSort.java and insertSort.java. See how the speeds of these three sorts compare.

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 Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

It would appear that someone apparently entered illegally.

Answered: 1 week ago