Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the code for sorts in your language some where online. You will copy code from the internet (with citation!) and modify it to test.

Find the code for sorts in your language some where online. You will copy code from the internet (with citation!) and modify it to test.

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.

Submitting your results:

In a .docx file or other file that you can convert to pdf, include screen shots of each step (one screenshot of the code changed, two screenshots of the experiments for 10,000 and the larger array size) for each of the 3 sorts. A total of nine screenshots. Include a paragraph explaining each screenshot above each screen shot. Write a summary of conclusion comparing the algorithms, timing and why one would look at 10,000 vs. larger array for comparison.

Outline:

  1. LINEAR SEARCH
    1. Include commented code of method only.
  2. BINARY SEARCH
    1. Include commented code of method only.
  3. BUBBLE SORT
    1. Paragraph and Screenshot Number 1
    2. Paragraph and Screenshot Number 2
    3. Paragraph and Screenshot Number 3
  4. SELECTION SORT
    1. Paragraph and Screenshot Number 4
    2. Paragraph and Screenshot Number 5
    3. Paragraph and Screenshot Number 6
  5. INSERTION SORT
    1. Paragraph and Screenshot Number 7
    2. Paragraph and Screenshot Number 8
    3. Paragraph and Screenshot Number 9
  6. SUMMARY AND CONCLUSION
    1. Paragraph comparing Bubble, Insertion and Selection Sort algorithms.
    2. Paragraph comparing Bubble, Insertion and Selection Sort timing.
    3. Paragraph discussing the necessity to look at 10,000 and even larger arrays when testing timing.

Step by Step Solution

3.42 Rating (152 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 If x matches with an element return the index If x ... 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

Principles of Marketing

Authors: Philip Kotler, Gary Armstrong

14th Edition

132167123, 132997266, 9780132997263, 978-0132167123

More Books

Students also viewed these Programming questions