Interface IInputMutatingSort
An algorithm sorting the given list, directly modifying the list given in input and using such list as "workspace", rather than generating a brand new list sorted.
Namespace: MoreStructures.Lists.Sorting
Assembly: MoreStructures.dll
Syntax
public interface IInputMutatingSort
Remarks
The fact that the algorithm mutates the input list doesn't necessarily means that the algorithm is in place.
For example MergeSort is not an in-place algorithm, since it requires additional O(n) space to
perform the sorting (more than the O(log(n)) additional space allowed by the definition of in-place algorithm).
Still, MergeSort implements IInputMutatingSort, since it mutates the input into its
sorted version, and doesn't produce a fully sorted copy of the list.
Methods
| Improve this Doc View SourceSort<T>(IList<T>)
Sorts the provided
Uses the default comparer of instances of type T
to compare items.
Declaration
void Sort<T>(IList<T> list)
where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list |
Type Parameters
Name | Description |
---|---|
T | The type of items of the |
Remarks
Alternative to Sort<T>(IList<T>) when T
doesn't support
Sort<T>(IList<T>, IComparer<T>)
Sorts the provided
Uses the provided comparer
of instances of type T
to compare items.
Declaration
void Sort<T>(IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list to be sorted. |
IComparer<T> | comparer | The comparer of instances of |
Type Parameters
Name | Description |
---|---|
T | The type of items of the |
Remarks
Alternative to Sort<T>(IList<T>) when T
doesn't support