public static void SelectionSort <T>(T[] arr) where T : IComparable <T>
    {
        Debug.Assert(arr != null, "The array was null");
        Debug.Assert(arr.Length > 0, "Length was less than or equal to zero.");

        for (int index = 0; index < arr.Length - 1; index++)
        {
            int minElementIndex = FindMinElementIndex(arr, index, arr.Length - 1);
            Swap(ref arr[index], ref arr[minElementIndex]);
        }

        Debug.Assert(AssertionUtilities.IsSortedByAscending(arr), "The array is not sorted");
    }