The sort would probally be selection sort. But I only know how to sort one column. I would do it under a for loop with a x+1 as the test section, and then update my counter while couting what I am testing. But I just cant wrap my head around doing two. I am thinking it is a nested for loop within. But I cant think of trick to do it. My brain is spoiled by excel.
If you want to do a selection sort you need to use a nested for loop which has O(n2) complexity.
1 2 3 4 5 6 7 8 9 10 11
for( int i = 0; i < height; i++)
for( int j = 0; j < width; j++)
if(myArray[i][j] < myArray)
// This function swaps the cell in position i and j, with the first cell i.e. myArray