1. Engineering
  2. Computer Science
  3. 1 assume each element of an array list stored in...

Question: 1 assume each element of an array list stored in...

Question details

1. Assume each element of an array list, stored in row major order, occupies four bytes of storage. If array lists is declared by each of the following, and the base address of the array is 100, find the address of the indicated array element. Please show your work.

Integer list[1...50]; list[23]

integer list[0..20, 0..15]; list [8, 12]

integer list[-8..9, -11..22]; list [7, 16]

2. Develop a formula, as in our class discussion, to access an array element if the two dimensional array is stored in colum-major order. i.e., array elements are stored in memory column by column rather than row by row. Please show all work.

a) How many columns do we skip to get to the correct column in which our element is to be found?

b) How many array elements are in each column?

c) How many bytes does each column occupy in memory?

d) How many bytes do we skip in memory to get to the first memory location of the column in which our element is to be found?

e) What is the starting location in memory for the column in which our element is to be found?

f) How many elements do we skip in the correct column to get to the element whose memory location we're trying to locate?

g) How many bytes do these elements occupy in memory?

h) What is the memory location our element will be found at?

i) Simplifying the expression produces the following mapping function:

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution