public int Search(ArrayReader reader, int target)
        {
            int start = 0, end = 1;

            while (reader.Get(end) < target)
            {
                int newStart = end + 1;
                end  += (end * 2);
                start = newStart;
            }
            return(BinarySearch(reader, target, start, end));
        }
 private static int BinarySearch(ArrayReader reader, int key, int start, int end)
 {
     while (start <= end)
     {
         int mid = start + (end - start) / 2;
         if (key < reader.Get(mid))
         {
             end = mid - 1;
         }
         else if (key > reader.Get(mid))
         {
             start = mid + 1;
         }
         else
         {
             return(mid);
         }
     }
     return(-1);
 }