Question: You are given a 2-dimensional integer array A of size (n times n) and told that The integers in each row are in increasing order,

You are given a 2-dimensional integer array A of size (n times n) and told that The integers in each row are in increasing order, and The integers in each column are in increasing order. An example of such an arrangement (n a smaller scale) is shown below 1 7 9 14 19 6 18 21 26 29 11 24 28 42 44 20 32 37 47 52 31 49 61 72 99 Your task is to search for a given integer x. (a) How many steps would it take if you perform a binary search of the elements starting from the top row and ending in the bottom row? Use the Big-O notation to matrix of size (n times n). Answer. (b) How would you use the ordering of the rows and columns of A to "speed up" your search for x? Present your high-level idea in two sentences
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
