Code: Select all
if(low==high) {if(strcmp(key,forgn[low])==0) return low; else return 0;}
Code: Select all
if(low>high)
return 0;
and your sorting is not working, u know u cant do binary search when ur array is not sorted.
if you think your sorting works, than try this and see the output:
Code: Select all
input
hsjsjs sjsjsj
fdidks sksks
ddosls dkdjkdk
dkjdsk dsksks
adskjs akkaka
your code output after sorting:
hsjsjs sjsjsj
ddosls dkdjkdk
dkjdsk dsksks
adskjs akkaka
fdidks sksks