1) WAP to input numbers in a 3*3 matrix and find the saddle point.
A saddle point in an element is the smallest in the row but largest in the
column.
Example Matrix
Consider the following 3 * 3 matrix:
1 2 3
4 5 6
7 8 9
Step 1: Find the minimum element in each row:
o Row 0: 1 (at index [0][0])
o Row 1: 4 (at index [1][0])
o Row 2: 7 (at index [2][0])
Step 2: Check if any of these row minimums are the maximum in their
respective columns:
o Check 7 (Row 2, Column 0):
Column 0 values are 1, 4, 7.
The maximum value in Column 0 is 7.
Since 7 is the minimum in Row 2 and the maximum in Column 0, 7 is the Saddle Point (located
at row 2, column 0).
A Matrix with No Saddle Point
1 5 9
8 3 2
4 6 7
Row 0 min: 1- Max in Col 0 is 8 (1 not equal to 8)
Row 1 min: 2- Max in Col 2 is 9 (2 not equal to 9)
Row 2 min: 4- Max in Col 0 is 8 (4 not equal to 8)
None meet both conditions, so No Saddle Point exists for this matrix.