Example #1
0
 public void Reverse()
 {
     for (int i = 0; i < arr.Length / 2; ++i)
     {
         AuxFunc.Swap(ref arr[i], ref arr[arr.Length - 1 - i]);
     }
 }
Example #2
0
 public void Reverse()
 {
     for (int i = 0; i < top / 2; ++i)
     {
         AuxFunc.Swap(ref arr[i], ref arr[top - 1 - i]);
     }
 }
Example #3
0
 public void Reverse()
 {
     for (int i = 0; i < Size() / 2; ++i)
     {
         AuxFunc.Swap(ref arr[i + start], ref arr[end - i - 1]);
     }
 }
Example #4
0
        public void HalfReverse()
        {
            int n     = arr.Length;
            int slide = n % 2 == 1 ? 1 : 0;

            for (int i = 0; i < n / 2; ++i)
            {
                AuxFunc.Swap(ref arr[i], ref arr[i + n / 2 + slide]);
            }
        }
Example #5
0
        public void HalfReverse()
        {
            int n     = Size();
            int slide = n % 2 == 1 ? 1 : 0;

            for (int i = 0; i < n / 2; ++i)
            {
                AuxFunc.Swap(ref arr[i + start], ref arr[i + n / 2 + slide + start]);
            }
        }
Example #6
0
 public void Sort()
 {
     for (int i = 1; i < arr.Length; ++i)
     {
         int j = i;
         while ((j > 0) && (arr[j] < arr[j - 1]))
         {
             AuxFunc.Swap(ref arr[j - 1], ref arr[j]);
             --j;
         }
     }
 }
Example #7
0
 public void Sort()
 {
     for (int i = start; i < end; ++i)
     {
         int j = i;
         while ((j > start) && (arr[j] < arr[j - 1]))
         {
             AuxFunc.Swap(ref arr[j - 1], ref arr[j]);
             --j;
         }
     }
 }