dc.description.abstract |
In computer science, each sorting algorithm is better in some situation and has its own
advantages. For example, the insertion sort is preferable to the quick sort for small files and for
almost-sorted files. To measure the performance of each sorting algorithm, the most important
factor is runtime that a specific sort uses to execute a data. Because the fastest algorithm is the
best algorithm, it pays to know which is the sorting algorithm fastest.
In this study, we will determine the efficiency of the various sorting algorithms according to the
time and number of swaps by using randomized trials. The build environment will be built using
the Java language. The research will discuss and implement several sorting algorithms such as
bubble sort, selection sort, insertion sort and will also include complexity sort such as quick sort,
cocktail sort, and merge sort. I will represent these algorithms as a way to sort an array or
integers and run random trails of length. The research will provide the number of swaps and the
runtime of each sorting algorithm. To investigate, I create a package called “sorting” which
contains two classes. First is called “sorting Algorithms” which contains all sorting algorithms
that can be called from any other classes. Another is “sorting Test” which is the class that we
will use to test these sorting algorithms. The “sorting Test” class, will provide the amount of
swaps of each sorting algorithm and the runtime (in millisecond) to execute a sort. In the
experiment we will measure the runtime in millisecond because it can show the different of each
algorithm better than using second. Each algorithm takes short time to execute a sort. It takes less
than a second for a big size of array (n=50,000).
i |
en_US |