摘要: #include "stdafx.h" #include using namespace std; #define MAXSIZE 100 int bofei_bottom(int n) { int f[MAXSIZE]; f[0] = 0; f[1] = 1; for (int i = 2; i <= n; i++) { f[i] = f[i - 1] + f[i - 2]; ... 阅读全文
posted @ 2017-03-22 19:00 lineaar 阅读(547) 评论(0) 推荐(0) 编辑
摘要: // dongtaiguihua.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; int num[11]; #define c 2; int p[] = { 0,1,5,8,9,10,17,17,20,24,30 }; ////自顶向下递归实现///////... 阅读全文
posted @ 2017-03-22 11:38 lineaar 阅读(163) 评论(0) 推荐(0) 编辑
摘要: // erchashu_xiti.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; //////////定义树节点结构 typedef struct Tree { int key; Tree* p; Tree* left; Tree* right;... 阅读全文
posted @ 2017-03-21 23:38 lineaar 阅读(193) 评论(0) 推荐(0) 编辑
摘要: // duilie.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include using namespace std; struct QueueRecord; typedef struct QueueRecord *Queue; int IsEmpty(Queue Q); int IsFull(Queue Q); Que... 阅读全文
posted @ 2017-03-21 23:37 lineaar 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 主要是利用快排的RANDOMIZED_PARTTITION()函数返回一个第q小的数,且第q小的数的坐标是绝对坐标而不是相对坐标,比如输入坐标范围为[p,r]的数组,第q小的数会返回p+q-1的坐标。 阅读全文
posted @ 2017-03-17 23:32 lineaar 阅读(254) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include #include #include using namespace std; int RANDOM(int p, int r) { srand((unsigned)time(NULL)); return (rand() % (r - p + 1)) + p; } int partition(int a[], int p, ... 阅读全文
posted @ 2017-03-17 22:35 lineaar 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include #include #include #include using namespace std; int main() { stack stk; string str; cin >> str; char h; int sum, b; for (int i = 0; i = 'A'&&str[i] <= 'F') ... 阅读全文
posted @ 2017-03-17 21:24 lineaar 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 using namespace std; 5 typedef int ElementType; 6 7 8 struct TreeNode; 9 typedef struct TreeNode *Position; 10 typedef struct TreeNo... 阅读全文
posted @ 2017-03-16 23:11 lineaar 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include using namespace std; //是权位数列,B是输出数列,D是原数列,k是范围 void COUNTING_SORT(int A[], int B[],int D[], int k) { int C[10]; for (int i = 0; i = 0; i--) { B[C[A[i] - 1] - 1] = D[... 阅读全文
posted @ 2017-03-16 21:33 lineaar 阅读(132) 评论(0) 推荐(0) 编辑