This assignment is worth 40 points.
You should implement the following program in MIPS assembly:
void RandomFill(int ary[], int size) {
srand(time(NULL);
int i;
for (i=0;i<size;i++) {
ary[i] = rand()% 1000;
}
}
void PrintArray(int ary[], int size ){
int i;
for(i=0;i<size;i++) {
cout << arry[i].number << " ";
if (i % 10 == 9) {
cout << endl;
}
}
}
void BubbleSort(int array[], int size) {
// you must implement this
}
void BinarySearch(array, size, key, found) {
// you must implement this. Non-recursively please
// return 1 if the key is found
// return 0 if the key is not found
}
void PrintFound(int num, int found) {
cout << num << "was " ;
if (found == 0) {
cout << "not " ;
}
cout << "found in the array." << endl ;
}
void main() {
RandomFill(arr, 100)
PrintArray(arr, 100)
BubbleSort(arr, 100)
BinarySearch(arr, 100, 10,found)
PrintFound(10, found)
BinarySearch(arr, 100, 200,found)
PrintFound(200, found)
}
Please implement the following algorithms:
If you use any regesters that must be preserved across a call, you are responsible for doing this.