CircularListTSort Method

Sorts the elements in the entire CircularListT using the default comparer.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public void Sort()

Remarks

If T is an enum, this method uses the EnumComparer<TEnum>.Comparer; otherwise, the default comparer Comparer<T>.Default checks whether type T implements the IComparableT generic interface and uses that implementation, if available. If not, Comparer<T>.Default checks whether type T implements the IComparable interface. If type T does not implement either interface, Comparer<T>.Default throws an InvalidOperationException.

This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

On average, this method is an O(n log n) operation, where n is Count; in the worst case it is an O(n ^ 2) operation.

See Also