#include#include#includeusing namespace std;const int MAXV=510;const int INF=0x3fffffff;int N,M,S,D; //城市数,高速公路数,起点,终点bool visit[MAXV]; //标记...
分类:
其他好文 时间:
2015-03-09 20:38:33
阅读次数:
170
算法思路:
1、后序最后元素为根,根将中序分为左右子树
2、层序遍历利用队列实现,java使用LinkedList
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
class Node{
int key;
Node left;
Node right;
public Node...
分类:
其他好文 时间:
2015-03-09 11:04:05
阅读次数:
120
1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 class Node { 9 public: 10 int data; 11 int next; 12 ...
分类:
其他好文 时间:
2015-03-09 01:40:09
阅读次数:
145
#include#includeusing namespace std;const int MAX=1010;int n;int arr[MAX]; //存放原始数组int arrI=0;int CBT[MAX]; //二叉排序树层序遍历序列【思维】中序遍历在数组中存放的就是层序...
分类:
其他好文 时间:
2015-03-08 18:40:53
阅读次数:
132
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.
Starting from one root supplier, everyone on ...
分类:
其他好文 时间:
2015-03-08 17:15:36
阅读次数:
130
#include#include#include#includeusing namespace std;const int MAX=1010;int n,m; //n个节点,m个非叶子节点 long long int S; //待测权值long long int weight[M...
分类:
其他好文 时间:
2015-03-08 16:56:00
阅读次数:
177
#include#include#includeusing namespace std;const int MAX=100010;int DEPest=0;int root=-1,N;double P,r,sum=0;vector child[MAX]; //child[父亲][孩子]...
分类:
其他好文 时间:
2015-03-08 15:26:07
阅读次数:
138
#include#includeusing namespace std;const int MAX=100010;int DEPest=0,times=0;vector child[MAX]; //child[父亲][孩子] 二维数组表示树形结构void DFS(int root,i...
分类:
其他好文 时间:
2015-03-08 14:08:55
阅读次数:
178
#include#includeint main(){ int n; scanf("%d",&n); while(n--) { char str[110]; scanf("%s",str); int len=strlen(str); int numP=0,numT=0...
分类:
其他好文 时间:
2015-03-08 11:41:52
阅读次数:
142
#includeint main(){ int n; char xing; scanf("%d %c",&n,&xing); int num=1,i=1; while(1) { num = num + 2 * (i + 2); //一开始就超出,不改变i if...
分类:
其他好文 时间:
2015-03-07 19:57:45
阅读次数:
111