DOTS Geometry
 
Loading...
Searching...
No Matches
NativeSelection Class Reference

Static Public Member Functions

static unsafe void QuickSelect< T, U > (ref NativeList< T > list, U comparer, int k)
 Finds the kth smallest element in a list in O(n) - smallest being defined by a comparer (i.e. you can also use it to find the kth largest element) The list is changed during this process, such that the kth smallest element is at position k of the list, and all smaller elements are to the left, and all larger element are to the right of k.
 
static unsafe void QuickSelect< T, U > (ref NativeList< T > list, U comparer, int k, int left, int right)
 Finds the kth smallest element in a subset of a list in O(n) in the range [left, right) - smallest being defined by a comparer (i.e. you can also use it to find the kth largest element) The list is changed during this process, such that the kth smallest element is at position k + left of the list, and all smaller elements are to the left, and all larger element are to the right of k in the interval [left, right).
 

Member Function Documentation

◆ QuickSelect< T, U >() [1/2]

static unsafe void QuickSelect< T, U > ( ref NativeList< T > list,
U comparer,
int k )
static

Finds the kth smallest element in a list in O(n) - smallest being defined by a comparer (i.e. you can also use it to find the kth largest element) The list is changed during this process, such that the kth smallest element is at position k of the list, and all smaller elements are to the left, and all larger element are to the right of k.

Template Parameters
T
U
Parameters
list
comparer
k
Returns
Type Constraints
T :unmanaged 
U :unmanaged 
U :IComparer<T> 

◆ QuickSelect< T, U >() [2/2]

static unsafe void QuickSelect< T, U > ( ref NativeList< T > list,
U comparer,
int k,
int left,
int right )
static

Finds the kth smallest element in a subset of a list in O(n) in the range [left, right) - smallest being defined by a comparer (i.e. you can also use it to find the kth largest element) The list is changed during this process, such that the kth smallest element is at position k + left of the list, and all smaller elements are to the left, and all larger element are to the right of k in the interval [left, right).

Template Parameters
T
U
Parameters
list
comparer
k
left
right
Type Constraints
T :unmanaged 
U :unmanaged 
U :IComparer<T>