tive is to locate the largest array entry A[i, j] that is less than or equal to x, or to report that all components of A are gr
Find a sorted matrix: The input is a real number x and a matrix A[1..n, 1..m] of nm real numbers, with each row A[i, 1..m] and column A[1..n, j] sorted. The objective is to locate the largest array entry A[i, j] that is less than or equal to x, or to report that all components of A are greater than x. Create and test an iterative method that analyses as few matrix elements as feasible. Be cautious if you assume a simple binary search would fix the problem.
Find a sorted matrix: The input is a real number x and a matrix A[1..n, 1..m] of nm real numbers, with each row A[i, 1..m] and column A[1..n, j] sorted. The objective is to locate the largest array entry A[i, j] that is less than or equal to x, or to report that all components of A are greater than x. Create and test an iterative method that analyses as few matrix elements as feasible. Be cautious if you assume a simple binary search would fix the problem.
Step by step
Solved in 3 steps