#c coding for binary search