0
votes
3answers
178 views

Given an 2D array which is row and column wise sorted. What is the efficient way to search for an element?

For example, given a 2D array (a matrix) {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}} What are the solutions to find a number? say 6. Here's the code I tried using Binary search method - (code ...