Binary Search for numeric vector

Search given value in a sorted vector, returns the index of location where the value is found.
3.8K 次下载
更新时间 2009/7/9

查看许可证

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.

引用格式

Dr. Murtaza Ali Khan (2024). Binary Search for numeric vector (https://www.mathworks.com/matlabcentral/fileexchange/11287-binary-search-for-numeric-vector), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R14SP2
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Shifting and Sorting Matrices 的更多信息
致谢

参考作品: Binary Search

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

binarysearchnumvec/

版本 已发布 发行说明
1.1.0.0

BSD License

1.0.0.0

Spelling corrections in description