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

1. (a) Explain the way in which thedata is organised in a one-dimensional array.

ID: 3611368 • Letter: 1

Question

1.      (a) Explain the way in which thedata is organised in a one-dimensional array. Show how the memoryaddress of an array element can be calculated from the address ofthe first element in the array, the size of each element and theindex of the element inquestion.                                                                            

Answer: In an array the same amount of storage is allocated toeach array element. The array elements occupy successive places inmemory. If A is the memory location for the first element ofthe array and s is the amount of memory allocated to each elementthen the address of the ith element is A+(i-1)s.


My question is if this formula is for the address polinomial andif its identical to this one X+(Cx(i-1) +(j-1))

and if its not can u please give me an explaination where thefirst one is used and where the second one?





Explanation / Answer

1.      (a) Explain the way in which thedata is organised in a one-dimensional array. Show how the memoryaddress of an array element can be calculated from the address ofthe first element in the array, the size of each element and theindex of the element inquestion.                                                                            

Answer: In an array the same amount of storage is allocated toeach array element. The array elements occupy successive places inmemory. If A is the memory location for the first element ofthe array and s is the amount of memory allocated to each elementthen the address of the ith element is A+(i-1)s.


My question is if this formula is for the address polinomial andif its identical to this one X+(Cx(i-1) +(j-1))

and if its not can u please give me an explaination where thefirst one is used and where the second one?

They are not the same

The first is used for a 1 dimensional array. The second isthe address of an element for a 2 dimensional array (also known asa matrix) that is stored in column major order. The 2ndformula would be for element X[i][j]