Question: ? Write a MIPS assembly language function, shellSort() , to sort the volumes into ascending order (small to large). To sort the numbers, use the
? Write a MIPS assembly language function, shellSort(), to sort the volumes into ascending order (small to large). To sort the numbers, use the following Shell Sort2 algorithm.
h = 1; while ( (h*3+1) < length ) { h = 3 * h + 1;
}
while ( h>0 ) { for (i = h-1; i < length; i++) { tmp = lst[i]; j = i; for ( j=i; (j >= h) && (lst[j-h] > tmp); j = j-h) { lst[j] = lst[j-h]; }
lst[j] = tmp; }
h = h / 3;
}
Note, the algorithm assumes array indexs start at 0. As necessary, you can define additional variables.
# ---------------------------------------------------------------------------
# Arguments:
# $a0 - starting address of the list
# $a1 - list length
# Returns:
# sorted list (via reference)
.globl shellSort
.ent shellSort
shellSort:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
