link for file used as a referenced library httpsdrivegooglec
link for file used as a referenced library
https://drive.google.com/file/d/0B5sYndtQWKzSM3RfWjI0bFlPajA/view?usp=sharing
1. Create a class called MySortComparison and have it extend SortComparison.
2. In the main method, create a new instance of MySortComparison (using the no-arg
constructor) and call the executeAndWrite method.
3. Refresh your project.
4. Find the three text files that were generated - ascending.csv, descending.csv, and
random.csv.
5. Open each CSV (comma-separated value) file (your spreadsheet program should open it
by default) and inspect the results. The columns are array sizes. The values in the
middle of the table are elapsed execution run time in nanoseconds.
6. Note any patterns or major differences and discuss with a peer why the results are the
way they are when comparing the different algorithms with each other.
Part 2 - Implement the Sorting Algorithms
Tasks:
1. Start with Selection Sort.
2. In MySortComparison, override the corresponding sort method (selectionSort,
insertionSort, bubbleSort, mergeSort, or quickSort).
3. Write out the code that implements the sorting algorithm.
Solution
For first part It depends on the implementation. Usually all the internal librarary sorting algorithms are heavy optimized so the result you might see will be more efficient then ours. I have used lot of object comparision , creating and redundant too many objects. Can you improve it further? Yes you can and you can think of that, make some tweak and learn. Apart from that you will know that how different sorting algortihm perform in different types of input. And though many of us find Quick sort slow but if we randomised it , 99% of time it is faster than any sorting method that\'s why java still uses it for primitive type data. You can ask your teacher regarding that for more details.
