Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 8 - Data Abstractions - Chapter Review Problems - Page 408: 2

Answer

The address of the entry in the fifth row and seventh column: 1. When each entry requires two memory cells: 26 (base 10) 2. When each entry requires three memory cells: 64 (base 10)

Work Step by Step

Given: - Array dimensions: 6 rows, 8 columns - Array stored in row-major order - Each entry in the array requires two memory cells initially, and then three memory cells 1. When each entry requires two memory cells: - Total number of entries in the array = 6 rows * 8 columns = 48 entries - Size of each entry = 2 memory cells - Address of the array starting point = -50 (base 10) - Address of the entry in the fifth row and seventh column: - Row index = 5 - 1 = 4 (index starts from 0) - Column index = 7 - 1 = 6 (index starts from 0) - Address = Starting address + (Row index * Number of columns + Column index) * Size of each entry = -50 + (4 * 8 + 6) * 2 = -50 + (38 * 2) = -50 + 76 = 26 (base 10) 2. When each entry requires three memory cells: - Size of each entry = 3 memory cells - Using the same formula as above: - Address = Starting address + (Row index * Number of columns + Column index) * Size of each entry = -50 + (4 * 8 + 6) * 3 = -50 + (38 * 3) = -50 + 114 = 64 (base 10)
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.