-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Algorithms_PartitionPoint__1
Andrew Koryavchenko edited this page Jun 17, 2018
·
6 revisions
Returns the index i in the range [startIndex, endIndex - 1] such that predicate(list[j]) = true for j < i and predicate(list[k]) = false for k >= i or endIndex if no such i exists
The list should be partitioned according to the predicate
Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static int PartitionPoint<T>(
this IList<T> list,
int startIndex,
int endIndex,
Predicate<T> predicate
)
VB
<ExtensionAttribute>
Public Shared Function PartitionPoint(Of T) (
list As IList(Of T),
startIndex As Integer,
endIndex As Integer,
predicate As Predicate(Of T)
) As Integer
F#
[<ExtensionAttribute>]
static member PartitionPoint :
list : IList<'T> *
startIndex : int *
endIndex : int *
predicate : Predicate<'T> -> int
- list
- Type: System.Collections.Generic.IList(T)
The sorted list - startIndex
- Type: System.Int32
The minimum index - endIndex
- Type: System.Int32
The upper bound for the index (not included) - predicate
- Type: System.Predicate(T)
The predicate
- T
- The list element type
Type: Int32
The partition point
In Visual Basic and C#, you can call this method as an instance method on any object of type IList(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).