Question: 3.3 Find Min, Max, Mode and Median Define an integer array (unsorted) in your data segment, and write an assembly program to find the minimum,

3.3 Find Min, Max, Mode and Median

Define an integer array (unsorted) in your data segment, and write an assembly program to find the minimum, maximum, mode and median of the array. Note that you may want to sort the array first, because once the array is sorted, minimum, maximum and median are just numbers at certain indices. You can use your merge sort code. However, if you find it difficult to implement merge sort, just use a sort algorithm that is simpler to implement (e.g., bubble sort). Results should be saved in a pre-defined memory space.

You can define your input in the data segment as shown below:

.data

nums: .word 92, 31, 92, 6, 54, 54, 62, 33, 8, 52

length: .word 10

min: .word 0

max: .word 0

median: .word 0

In this example, you should save the minimum, maximum and median to the memory space pointed by the labels min", max" and median", respectively. Normally, for an even size array the median is defined as the average of the two numbers in the middle. For simplicity, you can just take the number at index [length/2].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!