हिंदी

A matrix M[–1...10, 4....13] is stored in the memory with each element requiring 2 bytes of storage. If the base address is 1200, find the address of M[2][7] when the matrix is stored Row Major Wise. - Computer Science (Theory)

Advertisements
Advertisements

प्रश्न

A matrix M[–1...10, 4....13] is stored in the memory with each element requiring 2 bytes of storage. If the base address is 1200, find the address of M[2][7] when the matrix is stored Row Major Wise.

संख्यात्मक
Advertisements

उत्तर

Row-Major order formula:

Address = Base Address [(i − Lr) × Total Columns (j − Lc)] × Element Size

Putting the values in given formula,

Lr = −1, Lc = 4, i = 2, j = 7,Total Columns = 10, Element Size = 2.

After putting the values

Address = 1200 + [(2 – (– 1)) × 10 + (7 − 4)] × 2

= 1200 + [(2 + 1) × 10 + 3] × 2

= 1200 + [3 × 10 + 3] × 2

= 1200 + 33 × 2

= 1266

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2024-2025 (March) Official Board
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×