Skip to content

M_CodeJam_Algorithms_PartitionPoint__1

andrewvk edited this page Mar 29, 2016 · 6 revisions

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

[This is preliminary documentation and is subject to change.]

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

Remarks

The list should be partitioned according to the predicate

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

Syntax

C#

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

VB

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

F#

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

Parameters

 

list
Type: System.Collections.Generic.IList(T)
The sorted list
from
Type: System.Int32
The minimum index
to
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