再帰的方法で順序表の中で二分検索(半角検索)
439 ワード
int Recurrence_Search_Bin(SSTable ST,KeyType key,int floor,int roof){
// ST key , , 0
if(floor > roof) return 0;
int mid = (floor + roof) / 2;
if(key == ST.elem[mid].key) return mid;
else if (key < ST.elem[mid].key) return Recurrence_Search_Bin(ST,key,floor,mid - 1);
else return Recurrence_Search_Bin(ST,key,mid + 1,roof);
}//Recurrence_Search_Bin