- 博客(10)
- 收藏
- 关注
原创 二叉搜索树
二叉搜索树的查找操作(尾递归) Position find (ElementType X,BinTree BST) { if(!BST) return NULL; if(X > BST->Data) return Find(X,BST->Right); else if (X < BST->D
2017-12-17 16:03:18 140
原创 二叉树的遍历
先序遍历 void PreOrderTraversal (BinTree BT) { if ( BT ) { printf("%d", BT->Data); PreOrderTraversal( BT->Left ); PreOrderTraversal( BT->Right );
2017-12-17 16:03:02 135
转载 大数运算模板
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> using namespace std; #define MAXN 9999 #define MAXSIZE 10 #define DLEN 4
2017-12-17 16:02:25 216
转载 多重背包问题模板
//多重背包问题模板#include <set>#include <map>#include <list>#include <cmath>#include <ctime>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <string>#include <vector>#incl
2017-12-17 16:00:59 228
转载 埃拉托色尼筛选法
#include <iostream>using namespace std;void FilterPrime(int n){ bool* isPrimes = new bool[n+1]; for(int i=2;i<=n;++i) isPrimes[i] = true; isPrimes[2] = true; for(int j=2;j<=n;+
2017-12-17 16:00:34 281
原创 Stack
用数组来完成堆栈 #define MaxSize 30 typedef struct { ElementType Data[MaxSize]; int Top; }Stack; //判断是否已满及压入 void Push(Stack *PtrS, ElementType item){ if(PtrS->To
2017-12-17 16:00:00 141
原创 Queue
Queue的数组定义 //队列 数组实现 #define MaxSize 100 typedef struct { ElementTyPe Data[MaxSize]; int front; int rear; }Queue; //入队列 void AddQ(Queue *PtrQ,ElementTyPe
2017-12-17 15:58:54 194
原创 List
List的数组定义 //线性表数组定义 typedef struct{ ElementType Data[MAXSIZE]; int Last; }List; List L,*PtrL; //线性表数组建立 List *MakeEmpty(){ List *PtrL; PtrL = (List
2017-12-17 15:58:07 172
转载 MultipelePack-多重背包模版
# include<stdio.h># include<math.h># include<string.h>int f[105],V;inline int max(int a,int b){ return a>b?a:b;}void ZeroOnePack(int cost,int weight) //01背包{ int v; for(v=V;v>=cost;v-
2017-12-17 15:56:30 255
转载 01背包问题模板
//01背包问题模板# include <stdio.h> # include <stdlib.h> # include <string.h> # define max(x,y) x>y?x:y; int v[1001];//价值 int w[1001];//重量 int dp[1001][1001]; int main() { int n,m;
2017-12-17 15:55:17 522
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人