Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Complete Program Mips Assembly Language Implements Selection Sort Algorithm Sort Arr Q35542174

Write a complete program in MIPS assembly language thatimplements the selection sort algorithm to sort an arrayof integers in both ascending and descending order. The programmust be based on the C code presented below.main) int j, k, temp, min, direction; int length 9; int list17, 9. 4, 3, 8. 1, 6, 2, 5; printf(Enter 0 to sort in descending

int check( int direction, int j, int min ) if( direction 0 ) return( j>in ); else return( j min ); printData( int thelist[],

int check( int direction, int j, int min ) if( direction = 0 ) return(j min); else return( j < nin ); printData( int theList[

main) int j, k, temp, min, direction; int length 9; int list17, 9. 4, 3, 8. 1, 6, 2, 5; printf(“Enter 0 to sort in descending order.In”); printf(“Any number different than 0 will sort in ascending order.In”) scanf (“%d”, &direction); printf (“Before Sort:n”); printData(list, length); for k0; k< length-1; +k) for( j k + 1; j < length; ++) ) if ( check direction, list[j], liat[min])) nin-j; if( nin != k ) temp list [nin]; list[minlist [k]; list [k] temp; printf(“nnAfter Sort:n”) printData(list, length); printf(“n); int check( int direction, int j, int min ) if( direction 0 ) return( j>in ); else return( j min ); printData( int thelist[], int size ) int k; for( k = 0; k < size; ++k ) printf(“%d ” , thelist [k]); int check( int direction, int j, int min ) if( direction = 0 ) return(j min); else return( j < nin ); printData( int theList[], int size ) int k; for( k = 0; k < 812e ; ++k ) printf(“%d “, thelist [k]); Show transcribed image text main) int j, k, temp, min, direction; int length 9; int list17, 9. 4, 3, 8. 1, 6, 2, 5; printf(“Enter 0 to sort in descending order.In”); printf(“Any number different than 0 will sort in ascending order.In”) scanf (“%d”, &direction); printf (“Before Sort:n”); printData(list, length); for k0; k

Leave a Reply

Your email address will not be published. Required fields are marked *