Data Structures, Algorithms, & Applications in C++
Chapter 7, Exercise 35
- (a)
-
A sample antidiagonal matrix is given below:
0 0 0 1
0 0 3 0
0 0 0 0
6 0 0 0
- (b)
-
In an antidiagonal matrix there can be at most one nonzero
entry in each row; for row
i, this
nonzero entry is in column n+1-i. Therefore,
an n x n antidiagonal matrix can have at most
n nonzero entries.
A test program and output appear in the files
AntidiagonalMatrix.*.
- (c)
-
We can put the antidiagonal element
M(i, n+1-j)
in position i-1 of a one-dimensional array.