Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Make a random array of integers, then perform each search on them. LINEAR SEARCH Write a linear search method to find a number

In Java Make a random array of integers, then perform each search on them.

LINEAR SEARCH

Write a linear search method to find a number in the list. Call this before each of your sort methods. Include a comment explaining how Linear Search works, when to use it, when you cannot.

BINARY SEARCH

Write a binary search method to find a number in the list. Call this after each of your sort methods. Include a comment explaining how Binary Search works, when to use it, when you cannot.

BUBBLE SORT

Insert 10,000 items. Display the data before and after the sort. You’ll see that scrolling the display takes a long time. Take Screenshot Number 1 of the your changed code.

Next comment out the calls to display(). Add timing if necessary to see how long the sort itself takes. The time will vary on different machines. Take Screenshot Number 2 of your results.

Sorting 100,000 numbers will probably take less than 30 seconds. Now, select an array size that takes about this long and time it. Take Screenshot Number 3 of these results.

SELECTION SORT

Now, perform the same experiment on the Selection Sort using the same timing method you used. This will be  Screenshot Number 4, Screenshot Number 5, Screenshot Number 6.

INSERTION SORT

Now, perform the same experiment on the Selection Sort using the same timing method you used. This will be  Screenshot Number 7, Screenshot Number 8, Screenshot Number 9.ppp

Step by Step Solution

3.49 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

import javautilArrays import javautilRandom public class Test WORKING start with leftmost element of array and one by one compare x with each element ... 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

Data Structures and Algorithm Analysis in Java

Authors: Mark A. Weiss

3rd edition

132576279, 978-0132576277

More Books

Students also viewed these Programming questions

Question

What does a polygraph measure and why are its results questionable?

Answered: 1 week ago