My teacher has gave us this problem to practice for our finals. I don't know how to solve this one I'm confused. Can anyone please help me? We have to function that inserts a row of numerical data (i.e., a one-dimensional array) into a two-dimensional list of numbers.
For example, consider the list (6 rows) of numerical data shown here in 2-D array (called twoDArr) form (indices are shown on the top and the left):
0 1 2 3 4 5 6 7 8 9 10
0 2 4 6 8 10 12 14 16 18 20 22
1 4 8 12 16 20 24 28 32 36 40 44
2 5 10 15 20 25 30 35 40 45 50 55
3 6 12 18 24 30 36 42 48 54 60 66
4 7 14 21 28 35 42 49 56 63 70 77
5 8 16 24 32 40 48 56 64 72 80 88
6 g g g g g g g g g g g
3. Note that the seventh row has data but it would be considered garbage at this point.
4. Now consider the following one-dimensional array (called oneDArr) of data
(indices are shown at the top):
6. It is assumed that the two arrays always have the same number of columns, and that the insertIndex parameter provides the index at which to insert the row of
numbers (which is index 1 in this case). If the insertIndex value is outside the
bounds of the array data, the function should do nothing.
7. After the function call, the resulting two-dimensional array would contain the following data: