您当前的位置: 首页 >  算法

庄小焱

暂无认证

  • 3浏览

    0关注

    805博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

算法训练营——二分查找(第八课)

庄小焱 发布时间:2020-12-11 18:00:09 ,浏览量:3

二分查找
public int binarySearch(int[] array, int target) {
    int left = 0, right = array.length - 1, mid;
    while (left  target) {
            right = mid - 1;
        } else {
            left = mid + 1;
        }
    }

    return -1;
}
实际的题目 参考链接
  • 二分查找代码模板
  • Fast InvSqrt() 扩展阅读
实战题目
  • https://leetcode-cn.com/problems/sqrtx/
  • https://leetcode-cn.com/problems/valid-perfect-square/
课后作业
  • https://leetcode-cn.com/problems/search-in-rotated-sorted-array/
  • https://leetcode-cn.com/problems/search-a-2d-matrix/
  • https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/
关注
打赏
1657692713
查看更多评论
立即登录/注册

微信扫码登录

0.0398s