Problem # 15 : The Saddle Point
A saddle-point is defined as a point in a 2-dimensional table of numbers which is the lowest number in its row but the largest number in it's column.
Thus for the a table such as
01 | 06 | 08 |
29 | 12 | 45 |
13 | 10 | 07 |
Write a sub-routine SADDLE(A() N) which takes a double-dimension array of size (N N) A() and prints it's saddle point on a cleared screen.
Sample Output
If the array A() contains the elements mentioned in the table above
SADDLE(A()
3) should result in :
The Saddle Point is (2
2)=12
If A() =
12 | 53 | 23 | 54 |
23 | 55 | 27 | 74 |
14 | 12 | 2 | 84 |
2 | 44 | 67 | 4 |
If there are two or more Saddle Points
return any one and if there are no saddle
points SADDLE(A()
N) should result in :
"No Saddle Points"