自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 01背包

优化之前的代码优化之后的代码#include <iostream>#include <vector>#include <algorithm>using namespace std;const int maxv = 110;const int maxn = 10100;int w[maxn], dp[maxv];//w为每...

2019-03-13 13:28:50 103

原创 2013.1-kmp

getNext函数void getNext(string pattern, int next[]) { int k = -1, j = 0; next[j] = k; while(j < pattern.length()) { if(k == -1 || pattern[j] == pattern[k]) { next[+...

2019-03-12 23:58:40 134

转载 2012.2-求最大叶子间距

实际上是一个求树的直径问题#include <iostream>using namespace std;struct NODE{ NODE *pLeft; NODE *pRight;}; struct RESULT{ int nMaxDistance; int nMaxDepth;}; RESULT GetMaximumDist...

2019-03-12 22:47:21 157

原创 排序

//冒泡,快排//插排,希尔排序//选择排序,堆排序//归并排序//1.插入排序//默认当前元素之前的所有元素有序//把当前元素插入到之前元素中的合适位置void insert_sort(int a[], int n){ int i, j, k; for(i = 0; i < n; i++) { for(j = i-1, k = a[i...

2019-03-12 19:47:34 213

原创 2011.2-中序+后序输出前序

该题主要注意左子树的元素个数问题就好#include <iostream>#include <queue>using namespace std;const int maxn = 10010;struct node{ int data; node *left, *right;};int n;int in[maxn], post[m...

2019-03-12 19:23:35 199

转载 2011.1-dp-3个字符串的最大公共子串(难)

题目:输入3个子串, 输出这3个子串的最大公共子串相关题目:A1045 favorite color stripe(算法笔记上有两个相关的写法:最长不下降序列+最长公共子序列)#include <iostream>using namespace std;const int maxn = 10010;const int maxc = 10010;//使用最长不下降...

2019-03-12 18:47:19 263

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除