Consider the linear arrays XXX (-10:10), YYY (1935:1985), ZZZ (35).
(a) Find the number of element in each array.
(b) Suppose Base (YYY) = 400 and w=4 words per memory cell for YYY. Find the address of YYY [1942], YYY [1977] and YYY [1988].
Answer:
(a) Given Linear arrays are: XXX (-10:10), YYY(1935:1985) and ZZZ(35)
The number of elements is equal to the length. We can determine the length
By the following formula,
Length = UB – LB +1
For XXX the Upper Bound is 10 and the Lower Bound is -10
For YYY the Upper Bound is 1985 and the Lower Bound is 1935 and
For ZZZ the Upper Bound is 35 and Lower Bound is 1.
So,
Length (XXX) = UB (XXX) – LB (XXX) +1
= 10 – (-10) + 1
= 21
Then,
Length (YYY) = UB (YYY) – LB (YYY) +1
= 1985 – 1935 +1
= 51
And, Length (ZZZ) = UB (ZZZ) – LB (ZZZ) +1
= 35 – 1 +1
=35
(b) We know,
Address of any element of a linear array LA is determined by the formula,
LOC (LA[k]) = Base (LA) + w (k – lower bound)
Where,
Base (LA) = Base address of linear array LA.
w = Number of words per memory cell for the array LA
And k = Any elements of linear array LA
Given,
Base (YYY) = 400,
Lower Bound = 1935
And w = 4
SO, LOC (YYY [1942]) = 400 + 4(1942 – 1935)
= 428
LOC (YYY [1977]) = 400 + 4(1977 – 1935)
= 568
LOC (YYY [1988]) = 400 + 4(1988 – 1935)
= 612
I think everything wrote made a great deal of sense. However, think about this, suppose you wrote a catchier post title? I mean, I don’t wish to tell you how to run your website, however suppose you added a headline to maybe get a person’s attention? I mean BLOG_TITLE is a little vanilla. You should look at Yahoo’s home page and see how they write post headlines to get viewers to open the links. You might add a video or a picture or two to get people interested about what you’ve written. Just my opinion, it could make your website a little livelier.|
I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme? Great work!|
I don’t even know the way I ended up right here, but I thought this submit was great. I do not recognise who you’re however certainly you’re going to a well-known blogger in case you aren’t already. Cheers!|
I read this piece of writing fully regarding the comparison of newest and previous technologies, it’s amazing article.|
Awesome blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog stand out. Please let me know where you got your design. Thanks|