how to sort a large 2D matrix into a 1D array with limited RAM ?