Feedback Form

Get immediate access to thousands of

 high quality papers and essays.
Mega Essays Home  |   Questions?  |   Acceptable Use  |   Customer Care  |   Site Search
    Enter Essay Topic:

   

    Subjects:
Acceptance Essays
Arts
Custom Papers
English
Foreign
History
Miscellaneous
Movies
Music
Novels
People
Politics
Religion
Science
Sports
Technology

    Login:
Member Login
Join Now!
Click here to Join Now!
by: Credit Card
Click here to Join Now!
by: Online Check
Click here to Join Now!
by: Phone 1-900

CS sorting analysis

For this lab I tested ten different sorting methods by comparing the time it took to sort ordered, reverse ordered, and random ordered arrays of Integer objects of different sizes. I had to write a Timer class that started the timer before the sorting method was called and stopped the timer when the method was finished sorting the array. The elapsed time was calculated by another method in the Timer class so that the actual run time could be printed once the method completed. My test program contained methods to run all of the sorting methods given the size, type of array (ordered, reverse or random), and the number times to run the sorting method (all entered by the user) before the timer was stopped. For my timing experiment I carried out tests on an array of size 1,000 run 100 times through the method before printing the time (since it would be relatively fast for one iteration), an array of size 10,000 run 10 times, an array of size 25,000 run 1 time, and an array of 50,000 run 1 time. For the arrays of 1,000, 10,000, and 25,000 I did five trials for ordered, reverse, and random arrays to get a good average of the time it took since each run varied slightly. Since the array of 50,000 took a long time to run I conduct


Though there are sorts that run faster on ordered lists improve quick sort runs the best across the board and it is not slow on lists even of size 50,000. Since there is no significant difference between ordered and reverse ordered lists for the two quick sorts and improved quick sort runs faster on random lists I would say the "best" sort of the ten tested would be improved quick sort. This is not quite as predicted by the theoretical results. All of the sizes took about an equal amount of time since each element was composed of a maximum of 4 digits. When given a random array it is not likely that the middle element will be the exact middle value of all those in the array so the time to complete the sort takes a little longer. In all cases it ran slightly faster than improved quick sort on reverse ordered lists. The outcome of the experiments proved to be very similar to what was expected. Its best case was on the reverse ordered list, worse case was the ordered list and average was the random list. Shell Sort: Shell sort was significantly faster than insertion sort even though the worse case is still O(n2). Due to all the comparisons it has to do it is no surprise that is runs the slowest. Reverse and random were roughly the same. If given an almost reverse ordered list simple quick sort would be the best. If given a totally random list improved quick sort instead of simple quick sort since it gives the best chance of finding the element that will be closest to the middle. The run times are included at the end of this report.

Common topics in this essay:
, Sort Radix, Insertion Sort, Sort Improved, Quick Sort, Sort Surprisingly, Sort Shell, Bubble Sort, Merge Sort, Sort Recursive, quick sort, improved quick sort, improved quick, merge sort, insertion sort, simple quick sort, simple quick, theoretical results, reverse random, average run, heap sort, sort recursive, merge sort recursive, array 50000 run, quick sort runs,

See the rest of the paper. Join Now!

Approximate Word count = 1212
Approximate Pages = 5 (250 words per page double spaced)

Already a member? Click here

More Essays on CS sorting analysis


Student Papers:
logistics management 8420 words

Professional Papers:
Cognitive Behavioral Approach to Counseling6346 words
Emotions and Memories8780 words

Click here to Join Now!
by: Credit Card
Click here to Join Now!
by: Online Check
Click here to Join Now!
by: Phone 1-900



CREDIT CARD
ONLINE CHECK
JOIN BY PHONE



Get immediate access to over 100,000
high quality term papers and essays!!!

Webmasters make $$$!



All papers are for research and references purposes only!
Copyright (c) 2001-2009 Mega Essays LLC
All rights reserved. DMCA HMS