Final Exam Advance Algorithm
Final Exam Advance Algorithm
4. Explain the steps to find the position of the matrix value in a matrix series!
Answer:
The number we are searching for is greater than the current number. This will ensure, that all
the elements in the current row is smaller than the number we are searching for as we are
already at the right-most element and the row is sorted. Thus, the entire row gets eliminated
and we continue our search on the next row. Here elimination means we won’t search on that
row again.
The number we are searching for is smaller than the current number. This will ensure, that all
the elements in the current column is greater than the number we are searching for. Thus, the
entire column gets eliminated and we continue our search on the previous column i.e. the
column at the immediate left
The number we are searching for is equal to the current number
5.