会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
流白
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
6
7
8
9
10
11
12
13
下一页
2015年10月22日
leetcode@ [51/52] N-Queens
摘要: https://leetcode.com/problems/n-queens/ 1 class Solution { 2 public: 3 void dfs(vector> &ret, vector> map,int i, int j){ 4 if(i==map.size(...
阅读全文
posted @ 2015-10-22 11:23 流白
阅读(164)
评论(0)
推荐(0)
2015年10月16日
leetcode@ [121]Best Time to Buy and Sell Stock
摘要: Best Time to Buy and Sell StockTotal Accepted:69292Total Submissions:206193Difficulty:MediumSay you have an array for which theithelement is the price...
阅读全文
posted @ 2015-10-16 23:52 流白
阅读(205)
评论(0)
推荐(0)
2015年10月15日
algorithm@ dijkstra algorithm & prim algorithm
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const int maxn=6; 8 struct edge{ 9 int to,cost; 10 e...
阅读全文
posted @ 2015-10-15 21:23 流白
阅读(272)
评论(0)
推荐(0)
2015年10月8日
leetcode@ [18]4Sum
摘要: 1 struct quadruplet{ 2 int a,b,c,d; 3 quadruplet() {} 4 quadruplet(int aa,int bb,int cc,int dd){ 5 this->a=aa; this->b=bb; this->...
阅读全文
posted @ 2015-10-08 21:09 流白
阅读(171)
评论(0)
推荐(0)
2015年10月1日
leetcode@ [214]Shortest Palindrome
摘要: //to be continue... 1 class Solution { 2 public: int* buildNext(string T){ 3 int i=1,j; 4 int *next=new int[10000000]; 5 next[...
阅读全文
posted @ 2015-10-01 12:27 流白
阅读(156)
评论(0)
推荐(0)
2015年9月26日
大整数相乘
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main(){ 7 char a[101],b[101]; 8 int ans[220],len_ans; 9 cin>>a>>...
阅读全文
posted @ 2015-09-26 08:42 流白
阅读(173)
评论(0)
推荐(0)
2015年2月10日
algorithm@ KMP
摘要: 一. KMP算法KMP算法是一种改进的字符串匹配算法,由D.E.Knuth与V.R.Pratt和J.H.Morris同时发现,简称KMP算法。KMP算法的关键是利用匹配失败后的信息,尽量减少模式串与主串的匹配次数以达到快速匹配的目的。具体实现就是实现一个next()函数,函数本身包含了模式串的局部匹...
阅读全文
posted @ 2015-02-10 11:53 流白
阅读(1140)
评论(3)
推荐(2)
2015年2月9日
algorithm@ Matrix fast power
摘要: 一. 什么是快速幂:快速幂顾名思义,就是快速算某个数的多少次幂。其时间复杂度为 O(log₂N), 与朴素的O(N)相比效率有了极大的提高。一般一个矩阵的n次方,我们会通过连乘n-1次来得到它的n次幂。但做下简单的改进就能减少连乘的次数,方法如下:把n个矩阵进行两两分组,比如:A*A*A*A*A*A...
阅读全文
posted @ 2015-02-09 12:44 流白
阅读(1376)
评论(1)
推荐(0)
2015年2月6日
算法导论学习-线段树(2)
摘要: 线段树(1)http://www.cnblogs.com/fu11211129/p/4230000.html1. 线段树应用之动态点插与统计:--------------------------------线段树(1)中讲的应用是区段的插值与统计,我们在线段树结构体中接入cover之一域,cover...
阅读全文
posted @ 2015-02-06 11:48 流白
阅读(1223)
评论(0)
推荐(2)
算法导论学习-动态规划之记忆化搜索
摘要: 一. 动态规划动态规划(dynamic programming),与“分治思想”有些相似,都是利用将问题分 为子问题,并通过合并子问题的解来获得整个问题的解。于“分治”的不同之处在 于,对于一个相同的子问题动态规划算法不会计算第二次,其实现原理是将每一个计算过的子问题的值保存在一个表中。二. 记忆化...
阅读全文
posted @ 2015-02-06 00:25 流白
阅读(15855)
评论(3)
推荐(6)
上一页
1
···
6
7
8
9
10
11
12
13
下一页
公告