Class Extensions
Extensions methods for
Inheritance
System.Object
Extensions
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: MoreStructures.Lists.Sorting
Assembly: MoreStructures.dll
Syntax
public static class Extensions
Methods
| Improve this Doc View SourceIsSorted<T>(IList<T>)
Verifies that the provided list
is sorted.
Declaration
public static bool IsSorted<T>(this IList<T> list)
where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Type Parameters
Name | Description |
---|---|
T | The type of items of |
Remarks
Zips the list with itself, shifted one item forward.
Then checks whether each of the couples of the zip has a
Stops at the first encountered.
Time Complexity is O(n), when fully enumerated and in the worst case. Space Complexity is O(1).
IsSorted<T>(IList<T>, IComparer<T>)
Verifies that the provided list
is sorted, using the provided comparer
.
Declaration
public static bool IsSorted<T>(this IList<T> list, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The |
IComparer<T> | comparer | The |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Type Parameters
Name | Description |
---|---|
T | The type of items of |