#ifndef SEARCHDATA_TWODIMENSION_H
#define SEARCHDATA_TWODIMENSION_H
#include<iostream>
int searchData_TwoBinaryArray(int *arr,int lineNum,int columnNum ,int searchData){
int columnIndex=columnNum-1;
int lineIndex=0;
while(columnIndex>=0&&lineIndex<=lineNum-1&&arr!=NULL){
if(arr[lineIndex*lineNum+columnIndex]>searchData){
columnIndex--;
}else if(arr[lineIndex*lineNum+columnIndex]<searchData){
lineIndex++;
}else{
return 1;
}
}
return 0;
}
#endif
int main(){
int arr[16]={1,2,8,9,2,4,9,12,4,7,10,13,6,8,11,15};
std::cout<<searchData_TwoBinaryArray(arr,4,4,7)<<std::endl;
}