![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分搜索
文章平均质量分 72
liuchenjane
这个作者很懒,什么都没留下…
展开
-
Search a 2D Matrix
Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.T转载 2016-09-27 20:49:01 · 292 阅读 · 0 评论 -
240. Search a 2D Matrix II
240. Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending转载 2016-10-22 17:44:13 · 234 阅读 · 0 评论 -
300. Longest Increasing Subsequence
300. Longest Increasing Subsequence Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest incre原创 2016-10-22 21:53:50 · 356 阅读 · 0 评论 -
367. Valid Perfect Square
367. Valid Perfect Square Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt.转载 2016-10-25 09:06:04 · 295 阅读 · 0 评论 -
153. Find Minimum in Rotated Sorted Array
153. Find Minimum in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum ele转载 2016-10-20 15:55:47 · 252 阅读 · 0 评论 -
有序数组和无序数组的二分查找
1. 有序数组的二分查找这种情况下,也是最经常的二分查找。 已知一个已经按递增(或递减)排好序的数组,想找到某个数值为k的元素。根据下标idx查找#include <iostream> #include <vector> #include <string> using namespace std; int binary_search(vector<int> & nums, int num) {原创 2017-04-22 10:33:37 · 2751 阅读 · 0 评论