searching a sorted array of unknown length