摘要:#include using namespace std;void Sort(int* a,int num,int n){ int c = 2 * num + 1; while(c+1 a[c]){ c++; } if(a[c] > a...
阅读全文
摘要:#include using namespace std;void SelectSort(int* a,int n){ for(int i=0;i a[j] ){ int tmp = a[i]; a[i] = a[j]; ...
阅读全文
摘要:1、邻接矩阵#include using namespace std;#define MaxSize 100typedef char VertexType[3];typedef struct Vertex{ int adjvex; //顶点编号 VertexType da...
阅读全文
摘要:#include using namespace std;void InsertSort(int* a,int n){ for(int i=1;i tmp){ for(int k=i;k>j;k--){ a[k] = a[k-...
阅读全文
摘要:#include using namespace std;void ShellSort(int* a,int n){ int Step = n/2; while(Step > 0){ for(int i=Step;i= 0){ if(a[k] ...
阅读全文
摘要:树的存储结构1.双亲数组存储结构用一个一维数组存储树中的各个节点,数组元素是一个记录,包含data和parent两个字段,分别表示节点的数据值和其双亲在数组中的下标。其类型定义如下:typedef struct{ ElemType data; int parent;} ParType[MaxSize];在这个一维数组中,树中节点可按任意顺序存放。例如,图5-1中给出的树,它的双亲数组存储表示如图5-3所示。其中,规定下标为0的位置存储的节点是根节点。位置01234567空闲Maxsize-1dataABCDEFGH…parent-10002234… ...
阅读全文
摘要:HDFS是一个高度容错的分布式文件系统,为了保证数据的一致性采用“写入一次,多次读取”的方式。1、上传本地文件import java.io.IOException;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileStatus;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;public class CopeFile { public static void main(String[] arg...
阅读全文