public static void ShuffleNumbers(IList <int> numberArray) { Random random = new Random(); for (int i = 0; i < numberArray.Count - 1; i++) { int randomIndex = random.Next(i, numberArray.Count); ArrayInteraction <int> .SwapValues(numberArray, i, randomIndex); } }
public static void Sort(IList <int> items) { for (int i = 1; i < items.Count; i++) { int j = i; while (j > 0 && items[j - 1] > items[j]) { ArrayInteraction <int> .SwapValues(items, j - 1, j); j--; } } }
public static void Sort(IList <int> items) { int currentIndex = int.MinValue; int smallestindex = 0; for (int i = 0; i < items.Count; i++) { smallestindex = i; for (int j = i; j < items.Count; j++) { currentIndex = j; if (items[currentIndex] < items[smallestindex]) { smallestindex = currentIndex; } } ArrayInteraction <int> .SwapValues(items, i, smallestindex); } }