Example #1
0
 // Helper function
 private static void FillWithRandom(CircularList list, int numberOfElements)
 {
     Random rand = new Random();
     for (int i = 0; i < numberOfElements; i++)
     {
         list.Add(rand.Next(), i);
     }
 }
Example #2
0
 //Task 5
 private static void SantaBarbara(CircularList list, int SearchKey, int ElementToAdd)
 {
     int index = Search(list, SearchKey);
     if (index == -1) list.Add(ElementToAdd);
     else list.Add(ElementToAdd, index + 1);
 }
Example #3
0
 //Task 6
 private static void AddThree(int[] a, CircularList list)
 {
     for (int i = a.Length-1; i >= 0; i--)
     {
         list.Add(a[i], 3);
     }
 }