Implementation of 2D Arrays in Memory | Row major & Column major forms

Channel:
Subscribers:
1,540
Published on ● Video Link: https://www.youtube.com/watch?v=m2AWyX3WjTQ



Duration: 7:46
121 views
9


Implementation of 2D Arrays in Memory | Row major & Column major forms

Arrays are allocated contiguous memory locations. This requires two-dimensional arrays to be stored in linear form.
The layout of elements in memory for two-dimensional arrays can be organized in two ways:
1. Row-major form: Elements are stored row by row in memory.
Address of [I, J]th element: B + W[C(I – Lr) + (J – Lc)]
2. Column-major form: Elements are stored column by column in memory.
Address of [I, J]th element: B + W[R(J – Lc) + (I – Lr)]
The base address is the memory address of the first block of array.

#array #java #computerscience #isc







Tags:
row major form
column major form
implementation of two-dimensional arrays in memory
computer science
isc
arrays