private static void RunQuickselectDemo() { int[] array = new int[] { 3, 1, 2, 4, 3, 2, 8, 1, 0, 45, 2 }; var select = new Quickselect(); select.Select(array, 4, 0, array.Length - 1); // quick select 4 Console.WriteLine("Sorting Done."); }
public void KthSmallestElementInUnsorted_Test() { Quickselect ob = new Quickselect(); int[] arr = { 12, 3, 5, 7, 4, 19, 26 }; int n = arr.Length, k = 3; Assert.That(ob.FindKthSmallest(arr, k), Is.EqualTo(5)); }