Class StableComparer<T>
Stable comparer for stable sorting algorithm.
Inheritance
System.Object
StableComparer<T>
Implements
System.Collections.Generic.IComparer<System.Collections.Generic.KeyValuePair<System.Int32, T>>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Numerics.Comparers
Assembly: Mars.Numerics.dll
Syntax
public class StableComparer<T> : IComparer<KeyValuePair<int, T>>
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Remarks
This class helps sort the elements of an array without swapping
elements which are already in order. This comprises a
stable
sorting algorithm.
Constructors
| Improve this Doc View SourceStableComparer(Comparison<T>)
Constructs a new instance of the StableComparer<T> class.
Declaration
public StableComparer(Comparison<T> comparison)
Parameters
Type | Name | Description |
---|---|---|
System.Comparison<T> | comparison | The comparison function. |
Remarks
This class helps sort the elements of an array without swapping
elements which are already in order. This comprises a
stable
sorting algorithm.
See Also
Methods
| Improve this Doc View SourceCompare(KeyValuePair<Int32, T>, KeyValuePair<Int32, T>)
Compares two objects and returns a value indicating
whether one is less than, equal to, or greater than
the other.
Declaration
public int Compare(KeyValuePair<int, T> x, KeyValuePair<int, T> y)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Int32, T> | x | The first object to compare. |
System.Collections.Generic.KeyValuePair<System.Int32, T> | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A signed integer that indicates the relative values of x and y. |
Remarks
This class helps sort the elements of an array without swapping
elements which are already in order. This comprises a
stable
sorting algorithm.
See Also
Implements
System.Collections.Generic.IComparer<T>