Answered step by step
Verified Expert Solution
Question
1 Approved Answer
***IN C LANGUAGE /* Sort a matrix of size NxM in descending order. i.e. A[0] [0] would have the largest value and A [N] [M]
***IN C LANGUAGE
/* Sort a matrix of size NxM in descending order. i.e. A[0] [0] would have the largest value and A [N] [M] would have the smallest value. Example of a 3 times 3 sort: 9 8 7 6 5 4 3 2 1 */ int SortMatrix(int A[][], unsigned int rowsize, unsigned int colsize): /* Given a matrix of size NxM sorted in descending order and value V, write a function which returns -1 if value V is not in the matrix, else it returns 1 if V is in the matrix. The function also computes the position of v in the matrix, that is P= [R, C], where R is the row number of v and c is the column number of v in the matrix, is v is in the matrix (if v is not in the matrix then P=[-1, -1]): P is a 1D array of size 2. You must use the recursive Binary Search method./* int SearchMatrix (int A[] [], int V, int *P, unsigned int rowsize, unsigned int colsize): Write a main program which: a. reads a matrix of size N times M containing random integers between 0 and 100: b. sort the matrix in descending order: c. ask the user for a value V and search for V in matrix: in which case, the function will compute the position of v as p= [R, c] and return -1 or +1 depending if v is in A or notStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started