会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
卓行天下
博客园
首页
新随笔
联系
订阅
管理
2019年5月14日
算法——二分法查找(binarySearch)
摘要: 转自:https://blog.csdn.net/u012194956/article/details/79103843 二分法查找,也称为折半法,是一种在有序数组中查找特定元素的搜索算法。 二分法查找的思路如下: (1)首先,从数组的中间元素开始搜索,如果该元素正好是目标元素,则搜索过程结束,否则
阅读全文
posted @ 2019-05-14 09:31 卓行天下
阅读(379)
评论(0)
推荐(0)
2019年5月10日
[LeetCode] Add Two Numbers
摘要: class Solution {public: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { ListNode *ret = new ListNode(0); ListNode *cur = ret; int sum = 0; while
阅读全文
posted @ 2019-05-10 10:27 卓行天下
阅读(68)
评论(0)
推荐(0)
2019年5月9日
[LeetCode] Two Sum 两数之和
摘要: #include <iostream> using namespace std; int main(void) { int a, b; while(cin >> a >> b) { cout << a + b << endl; } return 0;}
阅读全文
posted @ 2019-05-09 17:47 卓行天下
阅读(84)
评论(0)
推荐(0)
公告