SelectLike

trait SelectLike extends Select

Given a function for finding approximate medians, this will create an exact median finder.

trait Select
class Any
object LinearSelect.type
object QuickSelect.type

Value members

Abstract methods

def approxMedian[@specialized A : Order](data: Array[A], left: Int, right: Int, stride: Int): A

Concrete methods

final def equalSpan[@specialized A](data: Array[A], offset: Int, stride: Int)(implicit o: Order[A]): Int
final def partition[@specialized A](data: Array[A], left: Int, right: Int, stride: Int)(m: A)(implicit o: Order[A]): Int
final def select[@specialized A : ClassTag](data: Array[A], k: Int): Unit

Puts the k-th element of data, according to some Order, in the k-th position. All values before k are less than or equal to data(k) and all values above k are greater than or equal to data(k).

Puts the k-th element of data, according to some Order, in the k-th position. All values before k are less than or equal to data(k) and all values above k are greater than or equal to data(k).

This is an in-place algorithm and is not stable and it WILL mess up the order of equal elements.

final protected def select[@specialized A : Order](data: Array[A], left: Int, right: Int, stride: Int, k: Int): Unit
final def sort[@specialized A](data: Array[A], left: Int, right: Int, stride: Int)(implicit o: Order[A]): Unit