Follow

Translate

Sunday, March 13, 2016

Solve Math problem By Using Linear Arrays

Solve Math problem By Using Linear Arrays:


(a) Find the number of elements in each array.
(b) Suppose Base(AAA) = 300 and W = 4 words per memory cell for AAA.  Find the addess of AAA[15], AAA[35] and AAA[55].


(a)  The number of elements is equal to the length; hence use the formula
                                  
                                                          Length = UB - LB + 1

Accordingly,  Length(AAA) = 50 - 5 + 1 = 46
                     Length(BBB)  = 10 - (-5) + 1 = 16
                     Length(CCC) = 18 - 1 + 1 = 18

Note that Length(CCC)  = UB, Since LB = 1

(b)  Use the formula   
                                 LOC(AAA[K])  = base(AAA) + W(K - LB)
      Hence:                 LOC(AAA[15]) = 300 + 4(15 - 5) = 340
                                  LOC(AAA[35]) = 300 + 4(35 - 5) = 420


AAA[55] is not an element of AAA, since 55 exceeds UB = 50
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment