Skip to content

M_CodeJam_Algorithms_PartitionPoint__1_2

Andrew Koryavchenko edited this page Jul 4, 2017 · 5 revisions

Algorithms.PartitionPoint(T) Method (IList(T), Predicate(T))

Returns the index i in the range [0, list.Count - 1] such that predicate(list[j]) = true for j < i and predicate(list[k]) = false for k >= i or list.Count if no such i exists

Remarks

The list should be partitioned according to the predicate

Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)

Syntax

C#

public static int PartitionPoint<T>(
	this IList<T> list,
	Predicate<T> predicate
)

VB

<ExtensionAttribute>
Public Shared Function PartitionPoint(Of T) ( 
	list As IList(Of T),
	predicate As Predicate(Of T)
) As Integer

F#

[<ExtensionAttribute>]
static member PartitionPoint : 
        list : IList<'T> * 
        predicate : Predicate<'T> -> int 

Parameters

 

list
Type: System.Collections.Generic.IList(T)
The sorted list
predicate
Type: System.Predicate(T)
The predicate

Type Parameters

 

T
The list element type

Return Value

Type: Int32
The partition point

Usage Note

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).

See Also

Reference

Algorithms Class
PartitionPoint Overload
CodeJam Namespace

Clone this wiki locally