Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

FRESNGSTATE Discovery. Diversity, Distinction. Electrical and Computer Engineeri

ID: 3605986 • Letter: F

Question

FRESNGSTATE Discovery. Diversity, Distinction. Electrical and Computer Engineering Fall 2017 Homework #4 ECE 118 Microprocessor Systems Due on 10/31/2017 in class. 1. Assume we have two preloaded data arrays, named Arrayl and Ara2, each has 40 items. Design an ARM assembly code to compare the items with the same index in the two arrays, such as compare Array 1 [O] to Aray2[OL ,Array 1 [10]to Array2[10] and so on. Always save the smaller value in Arrayl and greater one in Array2. Design a subroutine to implement the comparison part

Explanation / Answer

The algortihm would be to first find the length(n) of one array. Other array would also be of the same length as they are parallel arrays. Then for count=1 to count =n, check if the score[i] is greater than 25, if yes, print the name of the student (names[i]) along with the score (score[i]). Below is the pseudo code for the same:



// assume n is the lenght of the input arrays
n = score.length;

// for each element of the array, execulte loop once
Do for i = 1 to n {

   // check if the student has score gretaer than 75
   if score[i] > 75 then {
       Print names[i], score[i]
   }

}