Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
ListTools[BinarySearch] - perform a binary search on a list
Calling Sequence
BinarySearch(L, x, f, g)
Parameters
L
-
list
x
anything
f
(optional) procedure, operator, algebraic expression, or list
g
Description
The BinarySearch(L, x) function performs a binary search on list L for element x. List L is assumed to be sorted. If a match is found, the position of the element is returned; otherwise, the value is returned.
In this form of the calling sequence, x must be of type numeric or string and the list should have operands of the same type in ascending order.
If parameter f is specified in the calling sequence, it must be either a procedure or operator where returns true if x precedes y, or a list of the form such that returns true if x precedes y.
If g is specified in the calling sequence, it must be either a procedure or operator where returns true if x and y are equal, or a list of the form such that returns true if x and y are equal.
If g is not included, boolean equality is used to test if two objects are equal.
Examples
See Also
list, ListTools, ListTools[BinaryPlace], sort, type/list, type/numeric, type/string
Download Help Document