generator for binary search example