Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / CSCI 3301–MIPS Programming Using SPIM Programming Assignment Part 1 [50 points]: The factorial function is mathematically defined as:   ?                                                                                   ?! = ∏         ?                                                                                                                                                                      ?=1   For example, factorial of 6, that is 6! = 720, which is computer as: 6 ? 5 ? 4 ? 3 ? 2 ? 1

CSCI 3301–MIPS Programming Using SPIM Programming Assignment Part 1 [50 points]: The factorial function is mathematically defined as:   ?                                                                                   ?! = ∏         ?                                                                                                                                                                      ?=1   For example, factorial of 6, that is 6! = 720, which is computer as: 6 ? 5 ? 4 ? 3 ? 2 ? 1

Computer Science

CSCI 3301–MIPS Programming Using SPIM

Programming Assignment

Part 1 [50 points]:

The factorial function is mathematically defined as: 

 ?

                                                                                  ?! = ∏         ?

                                                                                                                                                                     ?=1

 

For example, factorial of 6, that is 6! = 720, which is computer as: 6 ? 5 ? 4 ? 3 ? 2 ? 1. 

Write a recursive MIPS assembly program using SPIM simulator (such as QtSpim), where for a given number (n) as an input (taken from the console), the program will recursively compute and return the corresponding factorial number. For retuning the result, use the standard console (screen) and print the output. You program must be able to take positive as well as negative integer numbers as input and must be able to respond appropriately.

 

Edge cases: 

  • 0! = 1 
  • Negative factorial is not defined. Return an error message. 
  • After 12 factorial, the output is larger than 32 bits. Therefore, return out of boundary error message. 
  • Also show some regular outputs, e.g. 6! = 720

 

 

 

 

 

 

 

 

 

 

 

Page 1

Part 2 [50 points]

Develop a MIPS program, “SORT”, to sort a set of given integers (note: both positive and negative integers are allowed) by the user. Note that, you can use any sorting algorithm you want including the Bumble sort which we covered in the class.

             

            First, your program will ask the user, how many numbers the user wants to enter, and   then ask the user to provide those numbers.         Your program will read in those numbers and               will place those numbers in an array. 

            Sort the array elements in ascending order. 

            Now, print the set of numbers that the user entered saying, “You have entered: …”.       Then, print the sorted list saying, “Here is the sorted list in ascending order: …”.

 

 

Edge cases: 

  • Empty array 
  • All negative integers in the array 
  • All positive integers in the array 
  • Positive and negative integers together in the array Page 2

Option 1

Low Cost Option
Download this past answer in few clicks

22.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions