Click or drag to resize
Accord.NET (logo)

SortPartialTKey, TValue Method (TKey, TValue, Int32, Boolean)

Partially orders a collection, making sure every element smaller than the n-th smaller element are in the beginning of the array.

Namespace:  Accord
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public static void Partial<TKey, TValue>(
	TKey[] keys,
	TValue[] items,
	int n,
	bool asc = true
)
where TKey : Object, IComparable<TKey>
Request Example View Source

Parameters

keys
Type: TKey
The keys that will be used to determine the order of elements in items.
items
Type: TValue
The array of elements from which the n-th element should be extracted.
n
Type: SystemInt32
The position to look for (0 returns the smallest element, 1 the second smallest, and so on).
asc (Optional)
Type: SystemBoolean
Whether to take the smallest or the largest element. If set to false, instead of returning the smallest, the method will return the largest elements in the beginning of the array.

Type Parameters

TKey
The type for the keys associated with each value in the items array.
TValue
The type for the items in the array.
See Also