多彩编程 多彩编程MZPH · CODE BLOG
ARTICLE DETAIL

文章详情

深耕前端与后端开发技术的一线实战笔记与踩坑复盘。

二分查找(基础)

二分查找(基础) 思路准备一组有序的数组设置target设置i0 j 数组.length - 1;循环ij设置中间值m (m (ij)/2 ,向下取整)做ifa[m] target- j m-1 else if (a[m] target) - im1 else 返回m(索引)循环失败返回 -1代码截图:测试
返回列表