Question: I'm trying to convert bubble sorting from java to MIPS. Please help me complete my code! Java Code for (int i=0; i

I'm trying to convert bubble sorting from java to MIPS. Please help me complete my code!

Java Code

for (int i=0; i

for(int j=i+1;j

if a[i] > a[j]{ int temp = a[i]; a[i] = a[j]; a[j] = temp;

}

}

}

MIPS Code

la $t0, Array

li $t1, 0

OuterLoop:

InnerLoop:

lw $s0, 0($t3)

add $t4, $t2, $t0

lw $s1, 0($t4) sw $s0, 0($t4)

sw $s1, 0($t3)

NotSwap:

blt $t1, 16, OuterLoop

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!