Example #1
0
 public static void DisplayAray(this ListInts list)
 {
     for (int i = 0; i < list.Size; i++)
     {
         if (i % 2 == 0)
         {
             list.DisplayElement(i);
         }
     }
     for (int i = 0; i < list.Size; i++)
     {
         if (i % 2 != 0)
         {
             list.DisplayElement(i);
         }
     }
 }
Example #2
0
        public static void ChangeAray(this ListInts list)
        {
            int min_index = 0, max_index = 0, tmp = 0;

            for (int i = 0; i < list.Size; i++)
            {
                if (list.GetElement(i) > tmp)
                {
                    max_index = i;
                }
            }
            tmp = list.GetElement(0);
            for (int i = 0; i < list.Size; i++)
            {
                if (list.GetElement(i) < tmp)
                {
                    min_index = i;
                }
            }
            tmp = list.GetElement(min_index);
            list.SetElement(min_index, list.GetElement(max_index));
            list.SetElement(max_index, tmp);
        }