public void TestTask9Method() { ar = new ArrayProcessing(); int[] array = { 12, 56, 23, 12, 57 }; int[] expected = { 68, 2 }; ar.arr = array; int[] actual = ar.task9(10); CollectionAssert.AreEqual(expected, actual); }
public void TestMDMethod() { ar = new ArrayProcessing(); int[] array = { 15, 25, 32 }; double[] expected = { 24, 73 }; ar.arr = array; double[] actual = ar.MO_Disp(); CollectionAssert.AreEqual(expected, actual); }
public void TestTask15Method() { ar = new ArrayProcessing(); int[] array = { 34, 123, 776, 23 }; int[] expcted = { 157, 2 }; ar.arr = array; int[] actual = ar.task15(); CollectionAssert.AreEqual(expcted, actual); }
public void TestSortArrayMethod1() { ar = new ArrayProcessing(); int[] expected = { 12, 31, 45, 65 }; int[] actual = { 31, 65, 12, 45 }; ar.arr = actual; actual = ar.array_sort(); CollectionAssert.AreEqual(expected, actual); }
static void Main(string[] args) { ArrayProcessing arrayProcessing = new ArrayProcessing(); int input = 0; Console.WriteLine("Welcome to Data Structure and Algorithm solution"); Console.WriteLine("Press 1 for Reversing array"); Console.WriteLine("Press 2 for Max of hourglass"); Console.WriteLine("Press 3 for Left rotation of an array"); Console.WriteLine(); //just to leave a line input = int.Parse(Console.ReadLine()); Console.WriteLine(); //just to leave a line switch (input) { case 1: int[] arrayOfIntegers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; arrayProcessing.ReverseArrayInASingleSpaceSeparatedIntegers(arrayOfIntegers); break; case 2: int[][] array = new int[6][] { new int[] { 1, 1, 1, 0, 0, 0 }, new int[] { 0, 1, 0, 0, 0, 0 }, new int[] { 1, 1, 1, 0, 0, 0 }, new int[] { 0, 0, 2, 4, 4, 0 }, new int[] { 0, 0, 0, 2, 0, 0 }, new int[] { 0, 0, 1, 2, 4, 0 } }; arrayProcessing.MaxOfTheSumOfHourGlass(array); break; case 3: int[] arrayToRotate = { 1, 2, 3, 4, 5 }; Console.WriteLine("Input the number of rotations"); int numberOfRotations = int.Parse(Console.ReadLine()); arrayProcessing.LeftRotationOfAnArray(arrayToRotate, numberOfRotations); break; case 4: string[] strings = { "def", "de", "jemil", "jemil", "fgh", "jemil" }; string[] queries = { "de", "lmn", "fgh", "jemil" }; arrayProcessing.SparceArrays(strings, queries); break; default: Console.WriteLine("Press a valid key between 1 and 2"); break; } // Keep the console window open in debug mode. Console.WriteLine("\n Press any key to exit."); Console.ReadKey(); }