Question: Q 2 : Saddle Point Finding in a 2 D List Weight: 2 5 % Last update: 1 2 Nov Let a saddle point in

Q2: Saddle Point Finding in a 2D List Weight: 25% Last update: 12 Nov Let a saddle point in a 2D list (matrix) be an element that is both the largest in its row and the smallest in its column. A matrix may have multiple saddle points or none at all. Write a Python program that to find all saddle points in a given 2D list (matrix) of natural numbers. Your function should return the indices of the saddle point as a tuple (row_index, col_index), or None if no saddle point exists. If multiple saddle points exist they should be sorted by row_index first and then col_index. Input Specification: n lines, each containing m numbers separated by spaces, representing the matrix. An empty line to indicate the end of the input. Output Specification: The indices of all saddle points as a tuple (row_index, col_index) or None. Case 1: 123456789(0,2) Case 2: 731452689 None Case 3: 9101081413161171010916171920(0,1)(0,2)(2,1)(2,2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!