Assume Two-Dimensional Sorted Array (TDSA) is a two-dimensional

matrix of size n × n such as the elements in the matrix are sorted

row-wise and column-wise. For example, the following matrix is a TDSA.

1 2 3

4 5 6

7 8 9

Write an algorithm that should convert the given matrix of a dimension

n × n into TDSA. Analyse the running time of the algorithm.