Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU OR GIVE OU A DISLIKE [Q-2] $$ begin{array) (1) text (Problem Description: Saddle point of

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU OR GIVE OU A DISLIKEimage text in transcribed

[Q-2] $$ \begin{array) (1) \text (Problem Description: Saddle point of a matrix W \text (Input: an integer matrix and two nonnegative integer numbers ! \mathrm{n} \text { and ) \mathrm{m} \text { representing the \text { numbers of rows and columns of the matrix, respectively (no restriction on } \mathrm{n} \text { and } \mathrm{m} \text(). The input) Problem Description: Saddle point of a matrix Input: an integer matrix and two nonnegative integer numbers n and m representing the numbers of rows and columns of the matrix, respectively (no restriction on n and m). The input has the following format: + line 1 contains n and m, separated by a white space + n following lines, each line has m numbers, separated by a comma + note that the last line does not contain 'n' Output: the saddle point value of the matrix, if it has, otherwise output an empty string For an nxm matrix M, the value at cell (1 ]) is a saddle point of the matrix if M[i][] is simultaneously the minimum value of the i_th row and the maximum value of the j_th column. Note that a matrix can have zero or multiple saddle points. But, if it has multiple saddle points, they are all equal. Requirement: You cannot use any array variable. To represent an array you must use a pointer variable. Hint: You should compute the min of each row and max of each column. Save them somewhere. Then look at each cell (1, 1) and check if it equals the min of row i and max of column]. Examples: Input1 33 1,2,3 4,5,6 7,8,9 Output 1 7 Input2 33-2,15,-2-5, -7,-4-6,20,-8 Output2 -2 Input3 3 3 8,1,9 7,2,6 3,4,5 Output3 input4 00 Output4 Inputs 34 -1,-2,- 1,3,-1-3,-5,-2,3,-5 0,0,0,1 Outputs: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

Students also viewed these Databases questions

Question

Build trust and credibility

Answered: 1 week ago

Question

Explain the causes of indiscipline.

Answered: 1 week ago

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

5. A review of the key behaviors is included.

Answered: 1 week ago