Compter Science

Topics: Sorting algorithm, Function, Mathematics Pages: 3 (984 words) Published: February 5, 2013
The aim of this report is to investigate the scaling of experiments on the runtime and number of comparisons while implementing the selection sort, merge sort with standard 2-way split and merge sort with a 3-way split on three different data structures: plain int array, the IntNode array, and the IntNode singly-linked list. Therefore, this report will be divided into three sections - part A, B and C, to respectively illustrate the analysis of different sort methods on the three different data structures. A wide range of numbers are used as different input size of this sort method in the experiments. In order to realize the average case performance of sort methods, all source data has been chosen in an irregular way.

Part A
In this part, the method of selection sort is implemented on the three data types. And the analysis is mainly about the number of comparisons and the runtime of selection sort.

As can be seen from the graph above that two curves of functions have been drawn: one represents the relation between the comparisons and the input size and the other represents a function whose tendency is similar to the function of comparison. Obviously, the value of comparisons is increasing at an increasing speed with the input size growing. Additionally, it seems that for all input size n which is greater than 0, the function value of the comparison is equal to or greater than that of the similar function. Accordingly, in conclusion, the number of comparisons complexity is O(n^2) with the input size n of the selection sort.

In the process of generating the time that it takes the system to implement the selection sort with a given input, the method of calculating the time difference from the start of the process to the end has been used.

It can be seen from the graph above that the runtime of the selection sort is increasing as the input size is growing and also increases more and more quickly. And a function with nearly similar trend has also...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Science Essay
  • Science Essay
  • Science and its Future Essay
  • Science Essay
  • Science Essay
  • Socrates: Philosophy to Science Essay
  • Physical Science Research Paper
  • Galileo on religion and science Essay

Become a StudyMode Member

Sign Up - It's Free