Made non-recursive binary search