Packages

o

scalation.util

BinarySearch

object BinarySearch

The BinarySearch object provides a method for binary search.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BinarySearch
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. def search[T](a: Array[T], key: T)(implicit arg0: (T) ⇒ Ordered[T]): (Int, Int)

    Find a key in the array/vector using binary search and return the position of the key (-1, if not found) along with the number of probes required.

    Find a key in the array/vector using binary search and return the position of the key (-1, if not found) along with the number of probes required. Works (switch comments) for both mutable Arrays and immutable Vectors.

    a

    the sorted array/vector to be searched

    key

    the key to find in 'a'