rotated arrays search (modified binary search)