private static void RandomExercises() { int[] numValues = { 8, 1, 2, 2, 3 }; ArrayExercises.SmallerNumbersThanCurrent(numValues); int[] FirstDuplicate = { 2, 1, 3, 5, 3, 2 }; Console.WriteLine(string.Format("{0} is the first duplicate.", ArrayExercises.FindFirstDuplicate(FirstDuplicate))); BinaryTree <int> MyTree = new BinaryTree <int>(); MyTree.Insert(6); MyTree.Insert(7); MyTree.Insert(8); MyTree.Insert(2); MyTree.Insert(7); MyTree.Insert(1); MyTree.Insert(3); MyTree.Insert(9); MyTree.Insert(1); MyTree.Insert(4); MyTree.Insert(5); MyTree.SumEvenGrandparent(MyTree.Find(6)); long binary_val = 100100111000000; BitManipulator x = new BitManipulator(); Console.WriteLine(x.GetDecimalValue(binary_val)); int[] luis = ManyExercises.BeautifulArray(4); int[] arri = { 1, 1, 2, 3, 3, 4, 4, 8, 8 }; int UniqueVal = ManyExercises.SingleNonDuplicate(arri); if (UniqueVal > -1) { Console.WriteLine(string.Format("Unique value is {0}.", UniqueVal)); } else { Console.WriteLine("No unique value is found in given array."); } Console.WriteLine("\n"); string a = "kqep"; string b = "pekeq"; CustomSortString.SortString(a, b); int[] Pancakes = { 3, 2, 4, 1 }; ArrayExercises.PancakeSort(Pancakes); // [[11,25,66,1,69,7],[23,55,17,45,15,52],[75,31,36,44,58,8],[22,27,33,25,68,4],[84,28,14,11,5,50]] int[][] matrix = new int[5][] { new int[] { 11, 25, 66, 1, 69, 7 }, new int[] { 23, 55, 17, 45, 15, 52 }, new int[] { 75, 31, 36, 44, 58, 8 }, new int[] { 22, 27, 33, 25, 68, 4 }, new int[] { 84, 28, 14, 11, 5, 50 } }; Console.WriteLine("Original Matrix:"); PrintMatrix(matrix); JaggedArray.DiagonalSort(matrix); Console.WriteLine("\nDiagonally Sorted Matrix:"); PrintMatrix(matrix); Console.ReadLine(); int[] arr = { 8, 3, 2, 7, 9, 1, 4, 1 }; Console.WriteLine("\n"); Console.WriteLine("Before SelectionSort:"); foreach (int i in arr) { Console.Write(i + ","); } Console.ReadLine(); SelectionSortAlgorithm.SelectionSort(arr); Console.WriteLine("\n"); Console.WriteLine("After SelectionSort:"); foreach (int i in arr) { Console.Write(i + ","); } Console.WriteLine("\n"); Console.ReadLine(); Console.Write("Binary Search. Enter number to search for: "); int.TryParse(Console.ReadLine(), out int key); BinarySearchAlgorithm.BinarySearch(arr, key); arr = Sorting(); int[] G = { 1, 2, 3, 3, 4, 5 }; Console.WriteLine(OneDimensionalArray.FindDuplicate(G)); Console.ReadLine(); int[] arrX1 = { 3, 4, -7, 1, 3, 3, 1, -4 }; OneDimensionalArray.FindSubarrayForGivenSum(arrX1, 7); var y1 = new int[] { 3, 1, 7, 5, 4, 9, 2 }; InsertionSortAlgorithm.InsertionSortBitWise(y1); PrintResults(y1); //ArrayExercises.StoreElementsInArray(); var x1 = new int[] { 1, 2, 3 }; var x2 = new int[] { 1, 2, 3 }; ArrayExercises.MergeToArraysSameSizeSorted(x1, x2); LeetCode lc = new LeetCode(); var groupSizes = new int[] { 3, 3, 3, 3, 3, 1, 3 }; var List111 = OneDimensionalArray.GroupThePeople(groupSizes); int[][] indices = new int[3][] { new int[] { 0, 0, 0 }, new int[] { 0, 0, 0 }, new int[] { 0, 0, 0 } }; lc.OddCells(2, 3, indices); }