How to find the saddle point of a matrix?


How to find the saddle point of a matrix and how to locate it in columns and rows?


A matrix is said to have a saddle point if some entry a[i][j] is the smallest value in the i'th row and the largest value in the j'th column. A matrix may have more than one saddle point.




Example:
Input:

20  30  40
56  78  45
1   2   3

Output:

23  30  40
56  78  45
1   2   3

The saddle point is 45 and its position is row2, column3.


Question: What function should i use to find the saddle point of the matrix and locate the rows and also the columns of the saddle point.

I'm a bit confuse on the saddle point part, i don't know what function to use to find the saddle point i'm stuck on the printing of the matrix.

I'm lacking of the saddle point function to finish my program.

Can anyone help me with this problem?
Have an array of 3 ints. For each row, store the smallest value in the corresponding element of the array. Then do the same for column in another array (find maximum value this time).
Now you have to find all points which are in both arrays. Note that in the 1st array position of the value shows column and in the 2nd, it shows row.
The arrays in your example would be
R = {0, 2, 0}; C = {1, 1, 1}
The points are (0; 0), (2; 1), (0; 2) and (0; 1), (1; 1), (2; 1). You see that 2;1 is there twice, thus it is your saddle point.
While you could write all points in another 6x2 array and compare them all, it is not necessary. A point in R is (R[j]; j) and a point in C is (i; C[i]). You need such i and j that R[j] = i and j = C[i]. From this comes that j == C[ R[j] ]
Thanks for your help hamsterman :) now i have an idea although i'm still confuse a bit but i think i can do it. ^___^ thanks.
Topic archived. No new replies allowed.