Programming pearls Problem 7 is about transposing a 4000 x 4000
matrix stored on a magnetic tape.
My solution was to simply use a temporary variable and swap the contents of a[i][j]
and a[j][i]
.
The solution given by the author confused me a little bit. He says we should:
- Prepend the row and column indices to each
- sort the records in the matrix by row
- remove the appended indices.
Why do you have to go through so much trouble to get this done? Does it have something to do with magnetic tapes?