in reply to sorting columns and getting the largest ansd smallest values in each column
If all you care about is the minimum and maximum value in the column, sorting is overkill. Sorting is an O(NlogN) operation. You can make a single pass (O(N)) through the values in the column, keeping track of the minimum and maximum values.