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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!