search a cyclically sorted array