Binary Search for numeric vector
by Dr. Murtaza Khan
03 Jun 2006
(Updated 09 Jul 2009)
Search given value in a sorted vector, returns the index of location where the value is found.
|
Watch this File
|
| File Information |
| Description |
INPUT:
x: vector of numeric values, x should already be sorted in ascending order
(e.g. 2,7,20,...120)
sval: numeric value to be search in x
OUTPUT:
index: index of sval with respect to x. If sval is not found in x then index is empty. |
| Acknowledgements |
The author wishes to acknowledge the following in the creation of this submission:
Binary Search
|
| MATLAB release |
MATLAB 7.0.4 (R14SP2)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 09 Jun 2006 |
Spelling corrections in description |
| 09 Jul 2009 |
BSD License |
|
Contact us at files@mathworks.com