Skip to content

M_CodeJam_Algorithms_PartitionPoint__1

Andrew Koryavchenko edited this page Jun 17, 2018 · 6 revisions

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

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

Remarks

The list should be partitioned according to the predicate

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

Syntax

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 

Parameters

 

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

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