Question: 1 . A useful application of two dimensional lists in programming is to represent grid - like structures. Consider the following grid of values: 0
A useful application of two dimensional lists in programming is to represent gridlike structures.
Consider the following grid of values:
a If we wanted to store this data in a two dimensional array, valueGrid, how would we ini
tialize it so that we accessed elements in rowmajor order? Row major order means that
we access the row first, then the column in the row: valueGridrowcol is the element at
row col in our grid.
Ex: valueGrid would be
valueGrid
b While we normally think of grids in row major order, sometimes it is helpful to use column
major order Column major order means that we access the column first, and then the
row; valueGridcolrow is the element at row col in our grid. Ex: valueGrid would
be How would we initialize valueGrid so that we used columnmajor order for the grid
above?
valueGrid
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
