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
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