lib/quickselect/singletco.js
function singletco(partition) {

	var select = function select(compare, a, i, j, k) {

		while (true) {

			if (j - i < 2) return;

			var p = partition(compare, a, i, j);

			if (k < p) j = p;else if (k > p) i = p + 1;else return;
		}
	};

	return select;
}
function singletco(partition) {

	var select = function select(compare, a, i, j, k) {

		while (true) {

			if (j - i < 2) return;

			var p = partition(compare, a, i, j);

			if (k < p) j = p;else if (k > p) i = p + 1;else return;
		}
	};

	return select;
}
function singletco ( partition ) { var select = function select ( compare , a , i , j , k ) { while ( true ) { if ( j - i < 2 ) return ; var p = partition ( compare , a , i , j ) ; if ( k < p ) j = p ; else if ( k > p ) i = p + 1 ; else return ; } } ; return select ; }
Template for the recursive implementation of quickselect with explicit tail
call optimization.
Template for the recursive implementation of quickselect with explicit tail call optimization .