In: Computer Science
Write a MIPS program to implement the Bubble Sort algorithm, that sorts an input list of
integers by repeatedly calling a “swap” subroutine.
The original unsorted list of integers should be received from the keyboard input. Your program should first prompt the user “Please input an integer for the number of elements:”. After the user enters a number and return, your program outputs message “Now input each element and then a return:”. For example, if the user enters 8 as the number of integers, and then the sequence of integers one by one: 6,5,9,1,7,0,-3,2,-8, it should display “The elements are sorted as: -8, -3, 0, 1, 2, 4, 6, 7, 9” (the output sequence of integers should be either space-separated or comma-separated).
The final sorted list (in increasing order) should be stored in the data area, that starts with the label "list:".
You should NOT implement a different sorting algorithm (e.g. mergesort or quick sort). You will receive 0% if your program does not call subroutine "swap", or if your sorted list is in decreasing order.
MIPS is stands for the "Microprocessor without Interlocked Pipelined Stages" is the assembly programming language that is used to design the MIPS processors.By using MIPS technology is also reduces the architecture of instruction set.
On the other hand, bubble sort is the sorting technique which is used to sort or arrange elements in either increasing or decreasing order. Some times it also knons as "sinking sort". The main advantage of using bubble sort is that elements are swapped without requiring any additional space. Complexities of the bubble sort is given as:
MIPS code for the bubble sort is given as: