Question
Problem 3 (30 points) Write a MIPS function (called my_inthist) that computes the histogram of an array of nonnegative integer values (no more than 100
Problem 3 (30 points) Write a MIPS function (called my_inthist) that computes the histogram of an array of nonnegative integer values (no more than 100 elements) and returns the number of unique values; your program should be named as my_inthist.s. The address of the input array will be passed in using register $a0, the number of elements using register $a1, and the address of the output array to save the results in $a2; you can assume the output array is large enough. The histogram of an array is the number of times each of its unique elements has appeared. For example, if the input array is [1, 5, 6, 1, 3, 1, 6, 4, 3, 2], your program needs to return 6 in $v0 and the values in the array given by $a2 should be [1, 3, 5, 1, 6, 2, 3, 2, 4, 1, 2, 1] (the numbers in red are the counts). You need to test your program using test_inthist.s (http://www.cs.fsu.edu/~liux/courses/cda3100/assignments/test_inthist.s) and include the results (shown on the console) in the pdf file to be submitted. Extra Credit Option (5 points): You will receive 5 extra credit points if the entries in your resulting array are sorted from small to large according to the values in the input array. For example, if the input array is [1, 5, 6, 1, 3, 1, 6, 4, 3, 2], then your result should be [1, 3, 2, 1, 3, 2, 4, 1, 5, 1, 6, 2]. You may use the sort program given in Figure 2.27 (p. 139) of the textbook.
if prompted when following link:
username: cda3100
password: cda3100-fsu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started