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

Binary search for elements in an array

高洛峰
Release: 2016-12-19 16:27:36
Original
1485 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template