| (a) Time in seconds | (b) # in 1 hour | |
| sequential search | 60 | 9,000,000 |
| binary search | 0.69015 | 289692 |
| insertion sort | 9000 | 94868.33 |
| selection sort | 9000 | 94868.33 |
| Shellsort | 209.978 | 1,456,780.12 |
15 85 93 11 84 19 29 39 31 54 27 18 77 84 12 95 99 15 85 93 11 84 19 29 39 31 54 27 18 77 84 12 95 99 15 85 12 11 84 19 29 39 31 54 27 18 77 84 93 95 99
15 85 93 11 84 19 29 39 99 54 27 18 77 84 12 95 31 15 85 93 11 84 19 29 39 99 54 27 18 77 84 12 95 31 11 15 85 93 84 19 29 39 99 54 27 18 77 84 12 95 31
public static void selectSort(double[] list)
{
for (int top = list.length - 1; top > 0; top--)
{
0
int largeLoc = top;
for (int i = 1; i <= top; i++)
>
if (list[i] < list[largeLoc])
largeLoc = i;
double temp = list[top];
list[top] = list[largeLoc];
temp
list[largeLoc] = list[top];
}
}