// 2. How do you find the duplicate number on a given integer array? (solution) void Question2(int[] arr) { var h = new HelperFunctions(); h.ArrayPrinter(arr); h.ArrayAscendingSorter(arr); h.ArrayPrinter(arr); h.DuplicateFinder(arr); }
// 1. How do you find the missing number in a given integer array of 1 to 100? (solution) void Question1(int[] arr) { Console.WriteLine("Hello World!"); var h = new HelperFunctions(); h.ArrayPrinter(arr); h.ArrayAscendingSorter(arr); // Since arrays are passed by value, // the array doesn't need to be passed around h.ArrayPrinter(arr); h.FindMissingNumberFromSortedArray(arr); }
// 4. How do you find all pairs of an integer array whose sum is equal to a given number? (solution) void Question4(int[] arr) { var givenNumber = 5; var h = new HelperFunctions(); h.ArrayPrinter(arr); h.SumEqualsGivenNumberPairFinder(givenNumber, arr); }
// 3. How do you find the largest and smallest number in an unsorted integer array? (solution) void Question3(int[] arr) { var h = new HelperFunctions(); h.ArrayPrinter(arr); h.LargestNumberPrinter(arr); h.SmallestNumberPrinter(arr); }
// 6. How are duplicates removed from a given array? (solution) void Question6(int[] arr) { var h = new HelperFunctions(); h.ArrayPrinter(arr); h.DuplicateRemover(arr); }
// 10. How are duplicates removed from an array without using any library? (solution) void Question10(int[] arr) { var h = new HelperFunctions(); h.ArrayPrinter(arr); // TODO: }
// 7. How is an integer array sorted in place using the quicksort algorithm? (solution) void Question7(int[] arr) { var h = new HelperFunctions(); h.ArrayPrinter(arr); // TODO: Solution link C# https://www.w3resource.com/csharp-exercises/searching-and-sorting-algorithm/searching-and-sorting-algorithm-exercise-9.php }