Here is a comparison of selection sort and merge sort. A list of Integer objects is generated at random, two copies are made, and a copy is sorted by each of the two methods. The time taken by each is computed in milliseconds. The quantity of objects sorted ranges from 100 to 10,000. The software that was used for this purpose can be found by clicking here. You will also need MergeSort and Sorting, which provide the sorting methods being timed. Here is a chart of the performance. Of course each run will yield slightly different numbers, as will runs on different computers.
|
|
|
|
| 100 | 11 | 12 |
| 200 | 1 | 7 |
| 300 | 3 | 9 |
| 400 | 2 | 16 |
| 500 | 3 | 70 |
| 600 | 4 | 80 |
| 700 | 4 | 98 |
| 800 | 24 | 106 |
| 900 | 4 | 126 |
| 1000 | 4 | 145 |
| 2000 | 9 | 448 |
| 3000 | 27 | 975 |
| 4000 | 21 | 1771 |
| 5000 | 79 | 2809 |
| 6000 | 86 | 4033 |
| 7000 | 100 | 5309 |
| 8000 | 114 | 7345 |
| 9000 | 129 | 8927 |
| 10000 | 134 | 11468 |