< Summary

Information
Class: MoreStructures.Lists.Sorting.QuickSort.StartIndexPivotSelectionStrategy
Assembly: MoreStructures
File(s): /home/runner/work/MoreStructures/MoreStructures/MoreStructures/Lists/Sorting/QuickSort/StartIndexPivotSelectionStrategy.cs
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 24
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
Select(...)100%1100%

File(s)

/home/runner/work/MoreStructures/MoreStructures/MoreStructures/Lists/Sorting/QuickSort/StartIndexPivotSelectionStrategy.cs

#LineLine coverage
 1namespace MoreStructures.Lists.Sorting.QuickSort;
 2
 3/// <summary>
 4/// A <see cref="IPivotSelectionStrategy"/> always picking the lowest index of the window.
 5/// </summary>
 6/// <remarks>
 7/// Time and Space Complexity are O(1).
 8/// <br/>
 9/// While one of the simplest way of selecting a pivot, when used in a <see cref="IThreeWayPartitionStrategy"/> of a
 10/// <see cref="RecursiveQuickSort"/> instance, it makes quicksort run in quadratic time on pathological input
 11/// configurations, and in particular when the input window is already sorted in ascending order.
 12/// <br/>
 13/// To avoid phatological scenarios with this <see cref="IPivotSelectionStrategy"/>, setup a
 14/// <see cref="IShuffleStrategy"/> in the <see cref="RecursiveQuickSort"/> instance, different from
 15/// <see cref="IdentityShuffleStrategy"/>.
 16/// </remarks>
 17public class StartIndexPivotSelectionStrategy : IPivotSelectionStrategy
 18{
 19    /// <inheritdoc path="//*[not(self::remarks)]"/>
 20    /// <remarks>
 21    /// This specific implementation always picks the <paramref name="start"/> index.
 22    /// </remarks>
 55923    public int Select<T>(IList<T> list, IComparer<T> comparer, int start, int end) => start;
 24}