Finds the Kth smallest value in the given array. k starts with 0, so with k = 0, the smallest value is returned, k returns the second smallest value, and so forth.

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 5.1.0.0

Syntax

C#
public static T KthSmallestValue<T>(
	T[] a,
	int k
)
where T : Object, IComparable<T>
Visual Basic (Declaration)
Public Shared Function KthSmallestValue(Of T As {Object, IComparable(Of T)}) ( _
	a As T(), _
	k As Integer _
) As T
Visual C++
public:
generic<typename T>
where T : Object, IComparable<T>
static T KthSmallestValue(
	array<T>^ a, 
	int k
)

Parameters

a
Type: array< T >[]()[]
An array of T.
k
Type: System..::.Int32
Zero based integer specifing the Kth smallest element.

Type Parameters

T
Array data type. Must implement IComparable.

Return Value

See Also