Question: [MIPS] Please rewrite the C code below into MIPS. Any online converter cannot be accepted, please provide screen shots of the output #include void bubbleSort(int

[MIPS] Please rewrite the C code below into MIPS. Any online converter cannot be accepted, please provide screen shots of the output

#include void bubbleSort(int *num, int size) { int j; int flag = 1; //set flag to true to begin first pass. int temp; //holding variable. while(flag) { flag = 0; //set flag to false awaiting a possible swap. for(j = 0; j < size-1; j++) { if(*(num+j) < *(num+j+1)) //change to > for ascending sort { temp = *(num+j); //swap elements. *(num+j) = *(num+j+1); *(num+j+1) = temp; flag = 1; //shows a swap occurred. } } } } int main() { int array[] = {99, 88, 66, 77, 44, 55, 11, 33, 22}; printf("Before Sorting: "); for(int i = 0; i < 9; i++) printf("%d ", array[i]); printf(" "); bubbleSort(array, 9); printf("After Sorting: "); for(int i = 0; i < 9; i++) printf("%d ", array[i]); printf(" "); }

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!