摘要: #include#include#include#include#includeusing namespace std;//求最大公约数int gcd(int a, int b){ if (b == 0) return a; return gcd(b,a%b);}//---... 阅读全文
posted @ 2015-04-08 16:07 liuhg 阅读(674) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;void Print_LCS(int **b, string X,int m, int n);void LCS_Length(string X, string Y){ int m = X.length(); int ... 阅读全文
posted @ 2015-04-07 21:07 liuhg 阅读(275) 评论(0) 推荐(0) 编辑
摘要: //全排列问题void Perm(string list, int i){ if (i == list.length()) { for (int c = 0; c < list.length(); c++) { cout << list.... 阅读全文
posted @ 2015-04-07 08:25 liuhg 阅读(168) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;//rn=max(pi+rn-1)int Cut_Rod(int *p, int n){ if (n == 0) return 0; int q = -1; for (int i = 1; i =... 阅读全文
posted @ 2015-04-06 20:34 liuhg 阅读(269) 评论(0) 推荐(0) 编辑
摘要: #include#include#include #include #include using namespace std;//朴素模式匹配void Naive_String_Matcher(string T, string P){ int n = T.length(); int m ... 阅读全文
posted @ 2015-04-06 16:11 liuhg 阅读(196) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;class Queue{ int data[10]; int head; int tail;public: Queue(); void Enqueue(int dat); int Dequque();};Qu... 阅读全文
posted @ 2015-04-05 16:43 liuhg 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;class Stack{ int top; int data[10];public: Stack(); bool empty(); void push(int dat); int pop();};Stack:... 阅读全文
posted @ 2015-04-05 16:27 liuhg 阅读(169) 评论(0) 推荐(0) 编辑
摘要: void Swap(int *a, int *b) { int c = *a; *a = *b; *b = c; } 阅读全文
posted @ 2015-04-05 10:04 liuhg 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;void SelectSort(int *A, int len){ for (int i = 0; i = 0 && A[j]>tmp; j--) A[j + 1] = A[j]; A[... 阅读全文
posted @ 2015-04-04 09:20 liuhg 阅读(341) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;int Partition(int *A, int p, int r)// 划分{ int x = A[r]; int i = p - 1; for (int j = p; j < r; j++) { ... 阅读全文
posted @ 2015-04-03 23:16 liuhg 阅读(1454) 评论(0) 推荐(0) 编辑