Binary search
Factor documentation
>
Factor handbook
>
The language
>
Collections
>
Sequence operations
Prev:
Sorting sequences
Next:
Set-theoretic operations on sequences
The
binary search
algorithm allows elements to be located in sorted sequence in
O(log n)
time.
search
( seq quot -- i elt )
Variants of sequence words optimized for sorted sequences:
sorted-index
( obj seq -- i )
sorted-member?
( obj seq -- ? )
sorted-member-eq?
( obj seq -- ? )
See also
Ordering specifiers
,
Sorting sequences