/// <summary> /// Sort jagged array by maximum value /// </summary> /// <param name="jaggedArr">Array of arrays of integers</param> /// <param name="desc">Descending order</param> /// <exception cref="ArgumentNullException"> /// Thrown when jagged array or item of jagged array or parameter is null /// </exception> /// <exception cref="ArgumentException"> /// Thrown when jagged array or item of jagged array is empty /// </exception> public static void BubbleSortByMax(int[][] jaggedArr, bool desc = false) { Func <int[], int[], int> compare = new MaxItemComparer().Compare; BubbleSort(jaggedArr, (IComparer <int[]>)compare.Target, desc); }
/// <summary> /// Sort jagged array by maximum value /// </summary> /// <param name="jaggedArr">Array of arrays of integers</param> /// <param name="desc">Descending order</param> /// <exception cref="ArgumentNullException"> /// Thrown when jagged array or item of jagged array or parameter is null /// </exception> /// <exception cref="ArgumentException"> /// Thrown when jagged array or item of jagged array is empty /// </exception> public static void BubbleSortByMax(int[][] jaggedArr, bool desc = false) { var comparer = new MaxItemComparer(); BubbleSort(jaggedArr, comparer.Compare, desc); }