Import and explore the attached ISorter.cs file. It contains the ISorter interface, which consists
of only a single generic method with the following signature and purpose: void Sort<K>(
K[ ] array, int index, in
...
Import and explore the attached ISorter.cs file. It contains the ISorter interface, which consists
of only a single generic method with the following signature and purpose: void Sort<K>(
K[ ] array, int index, int num, IComparer<K> comparer ) Sorts the data elements stored in
the specified one-dimensional array in the range defined by the starting position index and the
number of subsequent elements num. The order of sorted elements is determined by the specified
comparer, or, if the comparer is null, by the default comparer for type K obtained through the
Comparer<K>.Default property. This method must throw the following exceptions:
ArgumentNullException if the array is null, . ArgumentOutOfRangeException if the given index
or num or both are negative, . ArgumentException if the values of index and num do not specify a
valid range within the given array. In order to make the type K compatible with the Sort method,
there is a constraint applied to this generic type that expects the implementation of the
IComparable<K> interface. That is, any concrete type to replace the placeholder K during
the runtime must implement the IComparable<K> and its mandatory CompareTo(K
another) method. This requirement ensures that the call to the Comparer<K>.Default
property is possible in case when the specified comparer equals null. Extend your
Vector<T> class by adding the following method: - void Sort( ISorter algorithm,
IComparer<T> comparer ) Sorts the elements in the entire Vector<T> collection
using the specified sorting algorithm and comparer. If the algorithm is null, the sorting
operation should be delegated to the Array.Sort as the default sorting method. If the comparer isnull, the order of sorted elements is determined by the default comparer for type T; that is, by
Comparer<T>.Default.
[Show More]