search in sorted matrix row and col wise