Question
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:
- LINEAR SEARCH
- Include commented code of method only.
- BINARY SEARCH
- Include commented code of method only.
- BUBBLE SORT
- Paragraph and Screenshot Number 1
- Paragraph and Screenshot Number 2
- Paragraph and Screenshot Number 3
- SELECTION SORT
- Paragraph and Screenshot Number 4
- Paragraph and Screenshot Number 5
- Paragraph and Screenshot Number 6
- INSERTION SORT
- Paragraph and Screenshot Number 7
- Paragraph and Screenshot Number 8
- Paragraph and Screenshot Number 9
- SUMMARY AND CONCLUSION
- Paragraph comparing Bubble, Insertion and Selection Sort algorithms.
- Paragraph comparing Bubble, Insertion and Selection Sort timing.
- 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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started