Instructions Python Saddle Points
User Manual:
Open the PDF directly: View PDF
.
Page Count: 1
Saddle Points
Detect saddle points in a matrix.
Say you have a matrix like this:
012
|---------
0 | 9 8 7
1 | 5 3 2 <--- saddle point at (1,0)
2 | 6 6 7
This matrix has a saddle point at the coordinates (1, 0), where
1 is the row and 0 is the column.
It’s called a “saddle point” because the value at that point, 5,
is greater than or equal to every element in its row (5, 3, 2)
and less than or equal to every element in its column (9, 5,
6).
A matrix may have zero, one, or more saddle points.
Your code should be able to provide the (possibly empty) list
of all the saddle points for any given matrix. The matrix may
be empty, square (equal number of rows and columns), or
rectangular (different numbers of rows and columns).