public static bool TestCountInversions() { var numbers = RandomIntArray().ToList(); if (Inversions.CountInversion(numbers) == Inversions.NumberOfInversions(numbers)) { return(true); } return(false); }
public static bool TestInversionsTwo() { var numbers = RandomIntArray().ToList(); numbers = MergeSorter.MergeSort(numbers.ToArray()).ToList(); var x = new Random().Next(1, 5); var y = new Random().Next(6, 10); var counter = 0; if (counter == Inversions.NumberOfInversions(numbers)) { return(true); } else { return(false); } }
//**************************************************************** //Test Q10 Inversions //**************************************************************** public static bool TestInversions() { var numbers = RandomIntArray().ToList(); numbers = MergeSorter.MergeSort(numbers.ToArray()).ToList(); var i = new Random().Next(1, 20); var x = numbers[0]; numbers[i] = numbers[0]; numbers[0] = x; if (Inversions.NumberOfInversions(numbers) == i - 1) { return(true); } else { return(false); } }