Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 5 (30 points) Multidimensional arrays can be stored in row major order or in column major order. Find the location (address) of particular element
Problem 5 (30 points) Multidimensional arrays can be stored in row major order or in column major order. Find the location (address) of particular element in a 2D array A. 1. In case of Column Major Order: The formula for finding location is: location (A[ij])-address of A [0,0] + ( i +(m*)) ) element_size 2. In case of Row Major Order: The formula for finding location is: location (A[i.j])-address of A [0,0] + ( (i * n) + j) ) . element size Where, is the location of the element in the ith row and jth column. is the base address of the array A. the number of bytes required to store single element of array A. is the total number of columns in the array. is the total number of rows in the array is the row number of the element LOC (A [i, j]) Address of A[o,o]: Element_size :is the column number of the element. Assuming A is 3 x 4 integer array with elements: 10 60 30 55 20 90 80 65 50 40 75 79 A = Element-size = 2, Base address of A[0,0] = 1000 Fill the following table values along with location labels and find the address LOC(AI2,3])? Row Major Order LOCIA[2,3])-? umn Major Or
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started