Search Results for

    Show / Hide Table of Contents

    Class Extensions

    Extensions methods for , in the context of list sorting.

    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 Source

    IsSorted<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 to check.

    Returns
    Type Description
    System.Boolean

    true if list is sorted, false otherwise.

    Type Parameters
    Name Description
    T

    The type of items of list.

    Remarks

    Zips the list with itself, shifted one item forward.
    Then checks whether each of the couples of the zip has a non-bigger than .
    Stops at the first encountered.
    Time Complexity is O(n), when fully enumerated and in the worst case. Space Complexity is O(1).

    | Improve this Doc View Source

    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 to check.

    IComparer<T> comparer

    The to be used to comparer T instances.

    Returns
    Type Description
    System.Boolean

    true if list is sorted, false otherwise.

    Type Parameters
    Name Description
    T

    The type of items of list.

    Remarks

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX