implement binary search(rec/non-rec)