BinaryPlace - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ListTools

  

BinaryPlace

  

perform a binary placement in a list

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

BinaryPlace(L, x, f, opt1, opt2, ...)

Parameters

L

-

list, Vector, or one-dimensional Array

x

-

anything

f

-

(optional) procedure, operator, or algebraic expression

opt1, opt2, ...

-

(optional) extra arguments to f

Description

• 

The BinaryPlace(L, x) function performs a binary placement of x in L, where L is assumed to be sorted.  It returns the greatest index n such that L[n] precedes x. If x precedes all elements in a list L, then the value  is returned.

  

In this form of the calling sequence, x must be of type numeric or string and L should contain values of the same type in ascending order.

• 

BinaryPlace also accepts a Vector or one-dimensional Array as its first argument. If x precedes all elements in an Array, then the value that is returned is the lowerbound of the Array minus one. Since Vectors, like lists, always have a lowerbound of 1, the value returned for a Vector in this case is .

• 

If L is a list, then the returned value  is such that  is still a sorted list. If L is a Vector or Array, then the returned value  is such that  is sorted.

• 

If three or more arguments are specified in the calling sequence, then  must return true if x precedes y.

Examples

(1)

(2)

(3)

(4)

(5)

An example with a reverse-sorted Array. Note that the eight elements of this Array are indexed with the numbers  up to .

By supplying  for f, we get BinaryPlace to understand the reverse ordering.

(6)

We find that the elements  up to  are the positive ones,  up to  are negative.

(7)

(8)

Compatibility

• 

The ListTools[BinaryPlace] command was updated in Maple 18.

• 

The L parameter was updated in Maple 18.

See Also

list

ListTools

ListTools[BinarySearch]

sort

type/list

type/numeric

type/string

 


Download Help Document