Home >php教程 >PHP开发 >Binary search for elements in an array

Binary search for elements in an array

高洛峰
高洛峰Original
2016-12-19 16:27:361504browse

The binary method searches for the target element in the array a with the length of len in ascending order.
If the search is successful, the subscript is returned.
Otherwise, it returns -1. PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:binary searchNext article:binary search