├── README.md └── hit_ds_code ├── sort ├── bin │ └── Debug │ │ └── sort.exe ├── main.cpp ├── obj │ └── Debug │ │ └── main.o ├── sort.cbp ├── sort.depend ├── sort.h └── sort.layout ├── 图 ├── AOE │ ├── AOE.cbp │ ├── AOE.depend │ ├── AOE.layout │ ├── bin │ │ └── Debug │ │ │ └── AOE.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Dijkstra │ ├── Dijkstra.cbp │ ├── Dijkstra.depend │ ├── Dijkstra.layout │ ├── bin │ │ └── Debug │ │ │ └── Dijkstra.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Floyd │ ├── Floyd.cbp │ ├── Floyd.depend │ ├── Floyd.layout │ ├── bin │ │ └── Debug │ │ │ └── Floyd.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Kruskal │ ├── Kruskal.cbp │ ├── Kruskal.depend │ ├── Kruskal.layout │ ├── bin │ │ └── Debug │ │ │ └── Kruskal.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Prim │ ├── Prim.cbp │ ├── Prim.depend │ ├── Prim.layout │ ├── bin │ │ └── Debug │ │ │ └── Prim.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Topologicalsort │ ├── Topologicalsort.cbp │ ├── Topologicalsort.depend │ ├── Topologicalsort.layout │ ├── bin │ │ └── Debug │ │ │ └── Topologicalsort.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o └── testdata.txt ├── 散列技术 ├── 带溢出表 │ ├── bin │ │ └── Debug │ │ │ └── 带溢出表.exe │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── 带溢出表.cbp │ ├── 带溢出表.depend │ └── 带溢出表.layout ├── 开散列 │ ├── bin │ │ └── Debug │ │ │ └── 开散列.exe │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── 开散列.cbp │ ├── 开散列.depend │ └── 开散列.layout └── 闭散列 │ ├── bin │ └── Debug │ │ └── 散列.exe │ ├── main.cpp │ ├── obj │ └── Debug │ │ └── main.o │ ├── 散列.cbp │ ├── 散列.depend │ └── 散列.layout ├── 树 ├── AVL │ ├── AVL.cbp │ ├── AVL.depend │ ├── AVL.h │ ├── AVL.layout │ ├── bin │ │ └── Debug │ │ │ └── AVL.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── BST │ ├── BST.cbp │ ├── BST.depend │ ├── BST.h │ ├── BST.layout │ ├── bin │ │ └── Debug │ │ │ └── BST.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Haffuman │ ├── Haffuman.cbp │ ├── Haffuman.depend │ ├── Haffuman.layout │ ├── bin │ │ └── Debug │ │ │ └── Haffuman.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── Tree_AND_BTtree │ ├── Tree_AND_BTtree.cbp │ ├── Tree_AND_BTtree.depend │ ├── Tree_AND_BTtree.layout │ ├── Turn.h │ ├── bin │ │ └── Debug │ │ │ └── Tree_AND_BTtree.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o ├── 动态链表二叉树--7种遍历 │ ├── BTtree.h │ ├── bin │ │ └── Debug │ │ │ └── 动态链表二叉树.exe │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── 动态链表二叉树.cbp │ ├── 动态链表二叉树.depend │ └── 动态链表二叉树.layout ├── 双亲表示法-等价类划分 │ ├── bin │ │ └── Debug │ │ │ └── 双亲表示法.exe │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── parents.h │ ├── 双亲表示法.cbp │ ├── 双亲表示法.depend │ └── 双亲表示法.layout ├── 数组存储结构及操作算法的实现-heapsort │ ├── bin │ │ └── Debug │ │ │ └── 数组存储结构及操作算法的实现.exe │ ├── heapsort.h │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── 数组存储结构及操作算法的实现.cbp │ ├── 数组存储结构及操作算法的实现.depend │ └── 数组存储结构及操作算法的实现.layout ├── 树的遍历-前后层序3种 │ ├── bin │ │ └── Debug │ │ │ └── 树的遍历.exe │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── tree.h │ ├── 树的遍历.cbp │ ├── 树的遍历.depend │ └── 树的遍历.layout ├── 森林(树)邻接表表示法及其操作算法的实现 │ ├── bin │ │ └── Debug │ │ │ └── 森林(树)邻接表表示法及其操作算法的实现.exe │ ├── forest.h │ ├── main.cpp │ ├── main.o │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── queue.h │ ├── stack.h │ ├── 森林(树)邻接表表示法及其操作算法的实现.cbp │ ├── 森林(树)邻接表表示法及其操作算法的实现.depend │ └── 森林(树)邻接表表示法及其操作算法的实现.layout ├── 线索树(中序)---前中后3种遍历 │ ├── bin │ │ └── Debug │ │ │ └── 线索树.exe │ ├── listtree.h │ ├── main.cpp │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── 线索树.cbp │ ├── 线索树.depend │ └── 线索树.layout └── 静态二叉链表--7种遍历 │ ├── BTtree.h │ ├── bin │ └── Debug │ │ └── 静态二叉链表.exe │ ├── main.cpp │ ├── obj │ └── Debug │ │ └── main.o │ ├── 静态二叉链表.cbp │ ├── 静态二叉链表.depend │ └── 静态二叉链表.layout └── 线性表 ├── list_array ├── array_list.cbp ├── array_list.depend ├── array_list.h ├── array_list.layout ├── bin │ └── Debug │ │ └── array_list.exe ├── main.cpp └── obj │ └── Debug │ └── main.o ├── list_link ├── bin │ └── Debug │ │ └── list_link.exe ├── in.txt ├── list_link.cbp ├── list_link.depend ├── list_link.h ├── list_link.layout ├── main.cpp └── obj │ └── Debug │ └── main.o ├── queue_array ├── Queue.cbp ├── Queue.depend ├── Queue.layout ├── bin │ └── Debug │ │ └── Queue.exe ├── main.cpp ├── obj │ └── Debug │ │ └── main.o └── queue.h ├── queue_link ├── bin │ └── Debug │ │ └── queue_link.exe ├── main.cpp ├── obj │ └── Debug │ │ └── main.o ├── queue_link.cbp ├── queue_link.depend ├── queue_link.h └── queue_link.layout ├── stack_array ├── bin │ └── Debug │ │ └── stack.exe ├── main.cpp ├── mystack.h ├── obj │ └── Debug │ │ └── main.o ├── stack.cbp ├── stack.depend └── stack.layout ├── stack_link ├── bin │ └── Debug │ │ └── stack_link.exe ├── main.cpp ├── obj │ └── Debug │ │ └── main.o ├── stack_link.cbp ├── stack_link.depend ├── stack_link.h └── stack_link.layout ├── static_state_link ├── bin │ └── Debug │ │ └── static_state_link.exe ├── main.cpp ├── obj │ └── Debug │ │ └── main.o ├── static_state_link.cbp ├── static_state_link.depend ├── static_state_link.h └── static_state_link.layout └── 三元组顺序表 ├── bin └── Debug │ └── 三元组顺序表.exe ├── main.cpp ├── obj └── Debug │ └── main.o ├── threemat.h ├── 三元组顺序表.cbp ├── 三元组顺序表.depend └── 三元组顺序表.layout /README.md: -------------------------------------------------------------------------------- 1 | 哈工大计算机学院软件设计实验。 2 | 3 | # [线性表](./hit_ds_code/线性表) 4 | 5 | * List 6 | * 数组实现 7 | * 链表实现 8 | * queue 9 | * 数组实现 10 | * 链表实现 11 | * stack 12 | * 数组实现 13 | * 链表实现 14 | * 三元组 15 | 16 | # [树](./hit_ds_code/树) 17 | 18 | * 静态/动态二叉树 19 | * 创建 20 | * 遍历方式 21 | * 前序递归 22 | * 中序递归 23 | * 后序递归 24 | * 前序非递归 25 | * 中序非递归 26 | * 后序非递归 27 | * 层序遍历 28 | * 应用 29 | * AVL 30 | * BST 31 | * BTree 32 | * 哈夫曼编码 33 | * 等价类划分 34 | 35 | # [图](./hit_ds_code/图) 36 | 37 | * 图的存储 38 | * 邻接表 39 | * 邻接矩阵 40 | * 拓扑排序和关键路径,[已被CSDN收录](http://blog.csdn.net/hit1110310422/article/details/9387485) 41 | * Prim 42 | * Floyd 43 | * Dijkstra 44 | 45 | # [排序](./hit_ds_code/sort) 46 | 47 | * 冒泡 48 | * 插入 49 | * 快排 50 | * 选择 51 | * 堆排 52 | * 归并 53 | 54 | # [散列](./hit_ds_code/散列技术) 55 | 56 | * 开散列 57 | * 闭散列 58 | * 带溢出表散列 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /hit_ds_code/sort/bin/Debug/sort.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/sort/bin/Debug/sort.exe -------------------------------------------------------------------------------- /hit_ds_code/sort/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "sort.h" 6 | #define maxlen 100000 7 | using namespace std; 8 | int test[maxlen],a[maxlen]; 9 | void reset() 10 | { 11 | srand((unsigned)time(NULL)); 12 | for(int i=0; i 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/sort/sort.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/sort/sort.depend -------------------------------------------------------------------------------- /hit_ds_code/sort/sort.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/sort/sort.h -------------------------------------------------------------------------------- /hit_ds_code/sort/sort.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/AOE.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/AOE.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/AOE/AOE.depend -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/AOE.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/bin/Debug/AOE.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/AOE/bin/Debug/AOE.exe -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/AOE/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/图/AOE/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/AOE/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/Dijkstra.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/Dijkstra.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Dijkstra/Dijkstra.depend -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/Dijkstra.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/bin/Debug/Dijkstra.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Dijkstra/bin/Debug/Dijkstra.exe -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Dijkstra/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/图/Dijkstra/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Dijkstra/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/Floyd.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/Floyd.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Floyd/Floyd.depend -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/Floyd.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/bin/Debug/Floyd.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Floyd/bin/Debug/Floyd.exe -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Floyd/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/图/Floyd/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Floyd/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/Kruskal.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/Kruskal.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Kruskal/Kruskal.depend -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/Kruskal.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/bin/Debug/Kruskal.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Kruskal/bin/Debug/Kruskal.exe -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define MAXN 100+50 5 | #define MAXM 1000000 6 | using namespace std; 7 | int N,R; 8 | int p[MAXN],r[MAXM]; 9 | int u[MAXM],v[MAXM],w[MAXM]; 10 | bool cmp(const int i,const int j) {return w[i] < w[j];} 11 | int find(int x) { return p[x] == x? x : p[x] = find(p[x]); } //这个优化就是直接把要找的叶子连接在该树的树根上,就因为多了一个” p[i] = “. 优化到几乎为常熟 12 | void kruskal() 13 | { 14 | int ans = 0; 15 | int i,j=0; 16 | for(i=0; i>n &&n) 34 | { 35 | scanf("%d",&R); 36 | for(i=0; i> u[i] >>v[i] >> w[i]; 38 | kruskal(); 39 | } 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /hit_ds_code/图/Kruskal/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Kruskal/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/Prim.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/Prim.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Prim/Prim.depend -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/Prim.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/bin/Debug/Prim.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Prim/bin/Debug/Prim.exe -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Prim/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/图/Prim/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Prim/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/Topologicalsort.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/Topologicalsort.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Topologicalsort/Topologicalsort.depend -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/Topologicalsort.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/bin/Debug/Topologicalsort.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Topologicalsort/bin/Debug/Topologicalsort.exe -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Topologicalsort/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/图/Topologicalsort/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/图/Topologicalsort/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/图/testdata.txt: -------------------------------------------------------------------------------- 1 | AOE(P94): 2 | 9 11 3 | A B C D E F G H I 4 | 1 2 6 5 | 1 3 4 6 | 1 4 5 7 | 2 5 1 8 | 3 5 1 9 | 4 6 2 10 | 5 7 9 11 | 5 8 7 12 | 6 8 4 13 | 7 9 2 14 | 8 9 4 15 | prim(P60): 16 | 6 10 17 | 1 2 6 18 | 2 5 3 19 | 5 6 6 20 | 6 4 2 21 | 4 1 5 22 | 1 3 1 23 | 3 5 6 24 | 3 6 4 25 | 2 3 5 26 | 3 4 5 27 | Kruskal-----POJ:1287 28 | Dijkstra(P73): 29 | 5 8 30 | 1 2 10 31 | 1 4 30 32 | 1 5 100 33 | 2 3 50 34 | 3 4 20 35 | 3 5 10 36 | 4 3 20 37 | 4 5 60 38 | floyd(P73): 39 | 5 7 40 | 1 2 10 41 | 1 4 30 42 | 1 5 100 43 | 2 3 50 44 | 3 4 20 45 | 3 5 10 46 | 4 5 60 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/bin/Debug/带溢出表.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/带溢出表/bin/Debug/带溢出表.exe -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/带溢出表/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/带溢出表/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/带溢出表.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/带溢出表.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/带溢出表/带溢出表.depend -------------------------------------------------------------------------------- /hit_ds_code/散列技术/带溢出表/带溢出表.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/bin/Debug/开散列.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/开散列/bin/Debug/开散列.exe -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #define B 10000 6 | using namespace std; 7 | struct records 8 | { 9 | int key; 10 | char other; 11 | }; 12 | struct celltype 13 | { 14 | records data; 15 | celltype *next; 16 | }; 17 | typedef celltype *cellptr; 18 | typedef cellptr HASH[B]; 19 | inline int Hash(int k) 20 | { 21 | return k%B; 22 | } 23 | cellptr Search(int k, HASH F); 24 | void Delete(int k,HASH F); 25 | void Insert(records R, HASH F); 26 | void Init(HASH info); 27 | int main() 28 | { 29 | bool f=true; 30 | int n; 31 | records r; 32 | HASH info; 33 | Init(info); 34 | printf("1---Insert\n2---Delete\n3---Search\n5---Return\n"); 35 | while(f&&cin >> n) 36 | { 37 | switch(n) 38 | { 39 | case 1: 40 | cin >> r.key; 41 | Insert(r,info); 42 | break; 43 | case 2: 44 | cin >> r.key; 45 | Delete(r.key,info); 46 | break; 47 | case 3: 48 | cin >> r.key; 49 | cout << Search(r.key,info)->data.key<< endl; 50 | break; 51 | default: 52 | f=false; 53 | break; 54 | } 55 | } 56 | return 0; 57 | } 58 | void Init(HASH info) 59 | { 60 | for(int i=0; idata.key==k) 69 | return p; 70 | else p=p->next;//木有找到 71 | } 72 | return p; 73 | } 74 | void Insert(records R, HASH F) 75 | { 76 | if(Search(R.key,F)==NULL) 77 | { 78 | int locate=Hash(R.key); 79 | cellptr p=F[locate]; 80 | F[locate]=new celltype; 81 | F[locate]->data=R; 82 | F[locate]->next=p; 83 | } 84 | } 85 | void Delete(int k,HASH F) 86 | { 87 | int locate=Hash(k); 88 | cellptr p=F[locate],temp; 89 | if(p!=NULL) 90 | { 91 | if(p->data.key==k) 92 | { 93 | F[locate]=p->next; 94 | delete p; 95 | } 96 | else 97 | { 98 | temp=F[locate]; 99 | while(temp->next!=NULL) 100 | { 101 | if(temp->next->data.key==k) 102 | { 103 | p=temp->next; 104 | temp->next=p->next; 105 | delete p; 106 | } 107 | else temp=temp->next; 108 | } 109 | } 110 | } 111 | } 112 | 113 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/开散列/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/开散列.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/开散列.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/开散列/开散列.depend -------------------------------------------------------------------------------- /hit_ds_code/散列技术/开散列/开散列.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/bin/Debug/散列.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/闭散列/bin/Debug/散列.exe -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/闭散列/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/闭散列/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/散列.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/散列.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/散列技术/闭散列/散列.depend -------------------------------------------------------------------------------- /hit_ds_code/散列技术/闭散列/散列.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/AVL.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/AVL.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/AVL/AVL.depend -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/AVL.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/AVL/AVL.h -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/AVL.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/bin/Debug/AVL.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/AVL/bin/Debug/AVL.exe -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AVL.h" 2 | int main() 3 | { 4 | AVL test; 5 | node* x; 6 | test.Create(); 7 | x=test.return_rt(); 8 | test.in_order(x); 9 | cout << endl; 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /hit_ds_code/树/AVL/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/AVL/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/BST/BST.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/BST/BST.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/BST/BST.depend -------------------------------------------------------------------------------- /hit_ds_code/树/BST/BST.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/BST/BST.h -------------------------------------------------------------------------------- /hit_ds_code/树/BST/BST.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/BST/bin/Debug/BST.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/BST/bin/Debug/BST.exe -------------------------------------------------------------------------------- /hit_ds_code/树/BST/main.cpp: -------------------------------------------------------------------------------- 1 | //file:main.cpp 2 | #include "BST.h" 3 | int main() 4 | { 5 | BST test; 6 | test.CreateBST(); 7 | node* p=test.return_rt(); 8 | test.in_order(p); 9 | cout << endl; 10 | test.InsertBST(25,p); 11 | test.in_order(p); 12 | cout << endl; 13 | test.Delete(9,p); 14 | test.in_order(p); 15 | cout << endl; 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /hit_ds_code/树/BST/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/BST/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/Haffuman.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/Haffuman.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Haffuman/Haffuman.depend -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/Haffuman.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/bin/Debug/Haffuman.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Haffuman/bin/Debug/Haffuman.exe -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Haffuman/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/树/Haffuman/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Haffuman/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/Tree_AND_BTtree.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/Tree_AND_BTtree.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Tree_AND_BTtree/Tree_AND_BTtree.depend -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/Tree_AND_BTtree.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/Turn.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Tree_AND_BTtree/Turn.h -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/bin/Debug/Tree_AND_BTtree.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Tree_AND_BTtree/bin/Debug/Tree_AND_BTtree.exe -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Turn.h" 2 | int main() 3 | { 4 | Tree test; 5 | BTtree t; 6 | test.Create(); 7 | t=test.tree_to_bt(); 8 | return 0; 9 | } 10 | /* 11 | 9 12 | A 3 2 0 13 | B 6 5 4 0 14 | C 8 7 0 15 | D 0 16 | E 9 0 17 | F 0 18 | G 0 19 | H 0 20 | I 0 21 | */ 22 | -------------------------------------------------------------------------------- /hit_ds_code/树/Tree_AND_BTtree/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/Tree_AND_BTtree/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/BTtree.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/动态链表二叉树--7种遍历/BTtree.h -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/bin/Debug/动态链表二叉树.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/动态链表二叉树--7种遍历/bin/Debug/动态链表二叉树.exe -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/main.cpp: -------------------------------------------------------------------------------- 1 | //main.cpp 2 | #include "BTtree.h" 3 | int main() 4 | { 5 | BTtree tree; 6 | tree.pre_create(); 7 | tree.pre_order(tree.return_root()); 8 | cout << endl; 9 | tree.in_order(tree.return_root()); 10 | cout << endl; 11 | tree.post_order(tree.return_root()); 12 | cout << endl << endl; 13 | tree.nrec_pre_order(tree.return_root()); 14 | cout << endl; 15 | tree.nrec_in_order(tree.return_root()); 16 | cout << endl; 17 | tree.nrec_post_order(tree.return_root()); 18 | cout << endl << endl; 19 | tree.level_order(tree.return_root()); 20 | return 0; 21 | } 22 | //ABDH##I##E##CF#J##G## 23 | //ABDHIECFJG 24 | //HDIBEAFJCG 25 | //HIDEBJFGCA 26 | // 27 | //ABDHIECFJG 28 | //HDIBEAFJCG 29 | //HIDEBJFGCA 30 | // 31 | //ABCDEFGHIJ 32 | -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/动态链表二叉树--7种遍历/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/动态链表二叉树.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/动态链表二叉树.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/动态链表二叉树--7种遍历/动态链表二叉树.depend -------------------------------------------------------------------------------- /hit_ds_code/树/动态链表二叉树--7种遍历/动态链表二叉树.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/bin/Debug/双亲表示法.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/双亲表示法-等价类划分/bin/Debug/双亲表示法.exe -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/main.cpp: -------------------------------------------------------------------------------- 1 | #include "parents.h" 2 | int main() 3 | { 4 | MFSET test; 5 | test.Create(); 6 | test.Equivalence(); 7 | test.Print(); 8 | return 0; 9 | } 10 | /* 11 | 20 12 | 1 2 13 | 4 5 14 | 5 6 15 | 0 0 16 | */ 17 | -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/双亲表示法-等价类划分/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/parents.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARENTS_H_HITHUMING_INCLUDE_ 2 | #define _PARENTS_H_HITHUMING_INCLUDE_ 3 | #include 4 | #include 5 | #define maxlen 100 6 | using namespace std; 7 | template 8 | class MFSET; 9 | template 10 | class node 11 | { 12 | public: 13 | friend class MFSET; 14 | private: 15 | T data; 16 | int father; 17 | int count; 18 | }; 19 | template 20 | class MFSET 21 | { 22 | public: 23 | void Create(); 24 | int Find(int x); 25 | void Union(int A,int B); 26 | void Equivalence(); 27 | void Print(); 28 | private: 29 | node element[maxlen]; 30 | int size; 31 | }; 32 | template 33 | void MFSET::Print() 34 | { 35 | bool a[maxlen]; 36 | memset(a,true,sizeof(a)); 37 | for(int i=1; i<=size;i++) 38 | { 39 | if(a[i]==false) continue; 40 | cout << "("; 41 | int temp=Find(i); 42 | cout << element[i].data; 43 | for(int j=i+1;j<=size; j++) 44 | if(Find(j)==temp&&a[j]==true) 45 | { 46 | cout << ","< 53 | void MFSET::Union(int A,int B) 54 | { 55 | if(element[A].count > element[B].count) 56 | { 57 | element[B].father = A; 58 | element[A].count += element[B].count; 59 | } 60 | else 61 | { 62 | element[A].father = B; 63 | element[B].count += element[A].count; 64 | } 65 | } 66 | template 67 | int MFSET::Find(int x) 68 | { 69 | int temp=x; 70 | while(element[temp].father!=0) 71 | { 72 | temp=element[temp].father; 73 | } 74 | return temp; 75 | } 76 | template 77 | void MFSET::Create() 78 | { 79 | cin >> size; 80 | for(int i=1; i<=size; i++) 81 | { 82 | element[i].data=i; 83 | element[i].father=0; 84 | element[i].count=1; 85 | } 86 | } 87 | template 88 | void MFSET::Equivalence () 89 | { 90 | int i,j,k,m; 91 | 92 | while( cin>>i>>j&&!(i==0&&j==0)) 93 | { 94 | k=Find(i); 95 | m=Find(j); 96 | if(k!=m) 97 | Union(i,j); 98 | } 99 | } 100 | #endif 101 | -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/双亲表示法.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/双亲表示法.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/双亲表示法-等价类划分/双亲表示法.depend -------------------------------------------------------------------------------- /hit_ds_code/树/双亲表示法-等价类划分/双亲表示法.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/bin/Debug/数组存储结构及操作算法的实现.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/bin/Debug/数组存储结构及操作算法的实现.exe -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/heapsort.h: -------------------------------------------------------------------------------- 1 | //file :HEAPSORT.h 2 | #ifndef _HEAPSORT_H_HUMING_INCLUDE_ 3 | #define _HEAPSORT_H_HUMING_INCLUDE_ 4 | #include 5 | #define maxlen 10000 6 | using namespace std; 7 | template 8 | class array_BTtree 9 | { 10 | public: 11 | void setup(T a[],int n); 12 | void order(); 13 | void swap(int i,int j); 14 | int size(); 15 | void heapsort(); 16 | T see(int i); 17 | void pushdown(int first,int last); 18 | private : 19 | T data[maxlen]; 20 | int MAX; 21 | }; 22 | template 23 | void array_BTtree::heapsort() 24 | { 25 | int i; 26 | for(i=size()/2; i>=1; i--) 27 | pushdown(i,size()); 28 | // 整理堆,把最大的压在下面,小的不断向上 29 | for(i=size(); i>=2; i--) 30 | { 31 | swap(1,i); 32 | pushdown(1,i-1); 33 | }//最小的在最上面,然后和最后一个交换就可以得到一个降序的序列 34 | } 35 | template 36 | void array_BTtree::pushdown(int first,int last) 37 | { 38 | int r=first; 39 | while(r<=last/2) 40 | { 41 | if(last/2==r&&last%2==0)//只有左儿子 42 | { 43 | if(see(r)>see(2*r)) 44 | swap(r,2*r); 45 | r=last; 46 | } 47 | else if(see(r)>see(2*r)&&see(2*r)<=see(2*r+1)) 48 | { 49 | swap(r,2*r); 50 | r*=2; 51 | } 52 | else if(see(r)>see(2*r)&&see(2*r+1) 62 | void array_BTtree::swap(int i,int j) 63 | { 64 | T temp; 65 | temp=data[i]; 66 | data[i]=data[j]; 67 | data[j]=temp; 68 | } 69 | template 70 | void array_BTtree::setup(T a[],int n) 71 | { 72 | for(int i=1; i<=n; i++) 73 | data[i]=a[i]; 74 | MAX=n; 75 | } 76 | template 77 | void array_BTtree::order() 78 | { 79 | for(int i=1; i<=MAX; i++) 80 | cout << data[i]<< " "; 81 | } 82 | template 83 | int array_BTtree::size() 84 | { 85 | return MAX; 86 | } 87 | template 88 | T array_BTtree::see(int i) 89 | { 90 | return data[i]; 91 | } 92 | #endif 93 | -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/main.cpp: -------------------------------------------------------------------------------- 1 | //main.cpp 2 | #include "heapsort.h" 3 | int main() 4 | { 5 | array_BTtree t; 6 | int i,n,a[maxlen]; 7 | cin >> n; 8 | for(i=1; i<=n; i++) 9 | cin >> a[i]; 10 | t.setup(a,n); 11 | t.heapsort(); 12 | t.order(); 13 | return 0; 14 | } 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/数组存储结构及操作算法的实现.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/数组存储结构及操作算法的实现.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/数组存储结构及操作算法的实现.depend -------------------------------------------------------------------------------- /hit_ds_code/树/数组存储结构及操作算法的实现-heapsort/数组存储结构及操作算法的实现.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/bin/Debug/树的遍历.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/树的遍历-前后层序3种/bin/Debug/树的遍历.exe -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/main.cpp: -------------------------------------------------------------------------------- 1 | #include "tree.h" 2 | int main() 3 | { 4 | tree test; 5 | node* r; 6 | test.Create(); 7 | r=test.return_rt(); 8 | test.pre_order(r); 9 | cout << endl; 10 | test.post_order(r); 11 | cout << endl; 12 | test.level_order(r); 13 | return 0; 14 | } 15 | //AB#C#D### 16 | -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/树的遍历-前后层序3种/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/tree.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | template 5 | class tree; 6 | template 7 | class node 8 | { 9 | public: 10 | node():lchild(NULL),brother(NULL) {}; 11 | ~node() 12 | { 13 | delete lchild; 14 | delete brother; 15 | }; 16 | friend class tree; 17 | private: 18 | T data; 19 | node *lchild,*brother; 20 | }; 21 | template 22 | class tree 23 | { 24 | public: 25 | void Create(); 26 | node* return_rt(); 27 | void pre_order(node *P); 28 | void post_order(node *p); 29 | void level_order(node*p); 30 | private: 31 | node* root; 32 | node* Insert(); 33 | }; 34 | template 35 | void tree::level_order(node *t) 36 | { 37 | queue*> Q; 38 | node* q; 39 | if(t==NULL) return; 40 | else Q.push(t); 41 | while(!Q.empty()) 42 | { 43 | t=Q.front(); 44 | Q.pop(); 45 | cout << t->data; 46 | for(q=t->lchild;q!=NULL;q=q->brother) 47 | Q.push(q); 48 | } 49 | } 50 | 51 | template 52 | void tree::post_order(node* p) 53 | { 54 | node* q; 55 | if(p!=NULL) 56 | { 57 | for(q=p->lchild; q!=NULL; q=q->brother) 58 | post_order(q); 59 | cout << p->data; 60 | } 61 | } 62 | template 63 | void tree::pre_order(node *p) 64 | { 65 | if(p!=NULL) 66 | { 67 | cout << p->data; 68 | for(p=p->lchild; p!=NULL; p=p->brother) 69 | pre_order(p); 70 | } 71 | } 72 | template 73 | node* tree::return_rt() 74 | { 75 | return root; 76 | } 77 | template 78 | void tree::Create() 79 | { 80 | root=Insert(); 81 | } 82 | template 83 | node* tree::Insert() 84 | { 85 | T m; 86 | node *t; 87 | cin >> m; 88 | if(m=='#') return NULL; 89 | else 90 | { 91 | t=new node; 92 | t->data=m; 93 | t->lchild=Insert(); 94 | t->brother=Insert(); 95 | } 96 | return t; 97 | } 98 | -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/树的遍历.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/树的遍历.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/树的遍历-前后层序3种/树的遍历.depend -------------------------------------------------------------------------------- /hit_ds_code/树/树的遍历-前后层序3种/树的遍历.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/bin/Debug/森林(树)邻接表表示法及其操作算法的实现.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/bin/Debug/森林(树)邻接表表示法及其操作算法的实现.exe -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/forest.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/forest.h -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/queue.h: -------------------------------------------------------------------------------- 1 | #ifndef QUEUE_H_INCLUDED 2 | #define QUEUE_H_INCLUDED 3 | template 4 | class queue 5 | { 6 | public: 7 | queue(); 8 | ~queue(); 9 | void Enqueue(T value); 10 | void Dequeue(); 11 | T Front(); 12 | bool Empty(); 13 | private: 14 | struct node 15 | { 16 | T data; 17 | node *next; 18 | }; 19 | typedef node * QUEUE; 20 | QUEUE rear,front; 21 | }; 22 | template 23 | queue::queue() 24 | { 25 | front=new node; 26 | front->next=NULL; 27 | rear=front; 28 | } 29 | template 30 | queue::~queue() 31 | { 32 | QUEUE P=front,temp; 33 | while(P!=NULL) 34 | { 35 | temp=P->next; 36 | delete P; 37 | P=temp; 38 | } 39 | } 40 | template 41 | void queue::Enqueue(T value) 42 | { 43 | rear->next=new node; 44 | rear=rear->next; 45 | rear->data=value; 46 | rear->next=NULL; 47 | } 48 | template 49 | void queue::Dequeue() 50 | { 51 | if(!Empty()) 52 | { 53 | QUEUE tmp; 54 | tmp=front->next; 55 | front->next=tmp->next; 56 | delete tmp; 57 | if(front->next==NULL) rear=front; 58 | } 59 | } 60 | template 61 | T queue::Front() 62 | { 63 | if(!Empty()) 64 | return front->next->data; 65 | } 66 | template 67 | bool queue::Empty() 68 | { 69 | if(front==rear) 70 | return true; 71 | else return false; 72 | } 73 | #endif // QUEUE_H_INCLUDED 74 | -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/stack.h: -------------------------------------------------------------------------------- 1 | #ifndef STACK_H_INCLUDED 2 | #define STACK_H_INCLUDED 3 | template 4 | class stack 5 | { 6 | public: 7 | stack(); 8 | ~stack(); 9 | void push(T value); 10 | void pop(); 11 | T top(); 12 | bool empty(); 13 | int size(); 14 | private: 15 | struct node 16 | { 17 | T data; 18 | node *next; 19 | }; 20 | typedef node * STACK; 21 | STACK S; 22 | }; 23 | template 24 | stack::stack() 25 | { 26 | S=new node; 27 | S->next=NULL; 28 | } 29 | template 30 | stack::~stack() 31 | { 32 | STACK P=S,temp; 33 | while(P!=NULL) 34 | { 35 | temp=P->next; 36 | delete P; 37 | P=temp; 38 | } 39 | } 40 | template 41 | void stack::push(T value) 42 | { 43 | STACK tmp; 44 | tmp=new node; 45 | tmp->data=value; 46 | tmp->next=S->next; 47 | S->next=tmp; 48 | } 49 | template 50 | void stack::pop() 51 | { 52 | if(!empty()) 53 | { 54 | STACK tmp; 55 | tmp=S->next; 56 | S->next=tmp->next; 57 | delete tmp; 58 | } 59 | else return; 60 | } 61 | template 62 | T stack::top() 63 | { 64 | if(!empty()) 65 | { 66 | return S->next->data; 67 | } 68 | } 69 | template 70 | bool stack::empty() 71 | { 72 | if(S->next==NULL) 73 | return true; 74 | else return false; 75 | } 76 | template 77 | int stack::size() 78 | { 79 | int count=0; 80 | STACK tmp=S->next; 81 | while(tmp!=NULL) 82 | { 83 | count++; 84 | tmp=tmp->next; 85 | } 86 | return count; 87 | } 88 | 89 | #endif // STACK_H_INCLUDED 90 | -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/森林(树)邻接表表示法及其操作算法的实现.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/森林(树)邻接表表示法及其操作算法的实现.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/森林(树)邻接表表示法及其操作算法的实现.depend -------------------------------------------------------------------------------- /hit_ds_code/树/森林(树)邻接表表示法及其操作算法的实现/森林(树)邻接表表示法及其操作算法的实现.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/bin/Debug/线索树.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/线索树(中序)---前中后3种遍历/bin/Debug/线索树.exe -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/listtree.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/线索树(中序)---前中后3种遍历/listtree.h -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/main.cpp: -------------------------------------------------------------------------------- 1 | #include "listtree.h" 2 | int main() 3 | { 4 | Listtree test; 5 | test.Create(); 6 | test.to_list(); 7 | test.pre_order(); 8 | cout << endl; 9 | test.In_order(); 10 | cout << endl; 11 | test.Post_order(); 12 | cout << endl; 13 | return 0; 14 | } 15 | //ABDH##I##E##CF#J##G## 16 | -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/线索树(中序)---前中后3种遍历/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/线索树.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/线索树.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/线索树(中序)---前中后3种遍历/线索树.depend -------------------------------------------------------------------------------- /hit_ds_code/树/线索树(中序)---前中后3种遍历/线索树.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/BTtree.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/静态二叉链表--7种遍历/BTtree.h -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/bin/Debug/静态二叉链表.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/静态二叉链表--7种遍历/bin/Debug/静态二叉链表.exe -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/main.cpp: -------------------------------------------------------------------------------- 1 | //main.cpp 2 | #include "BTtree.h" 3 | int main() 4 | { 5 | BTtree test; 6 | test.pre_create(); 7 | test.pre_order(test.return_root()); 8 | cout << endl; 9 | test.in_order(test.return_root()); 10 | cout << endl; 11 | test.post_order(test.return_root()); 12 | cout << endl; 13 | test.nrec_pre_order(test.return_root()); 14 | cout << endl; 15 | test.nrec_in_order(test.return_root()); 16 | cout << endl; 17 | test.nrec_post_order(test.return_root()); 18 | cout << endl; 19 | test.level_order(test.return_root()); 20 | cout << endl; 21 | return 0; 22 | } 23 | //ABDH##I##E##CF#J##G## 24 | //ABDHIECFJG 25 | //HDIBEAFJCG 26 | //HIDEBJFGCA 27 | //ABDHIECFJG 28 | //HDIBEAFJCG 29 | //HIDEBJFGCA 30 | //ABCDEFGHIJ 31 | -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/静态二叉链表--7种遍历/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/静态二叉链表.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/静态二叉链表.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/树/静态二叉链表--7种遍历/静态二叉链表.depend -------------------------------------------------------------------------------- /hit_ds_code/树/静态二叉链表--7种遍历/静态二叉链表.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/array_list.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/array_list.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_array/array_list.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/array_list.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_array/array_list.h -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/array_list.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/bin/Debug/array_list.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_array/bin/Debug/array_list.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_array/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_array/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_array/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/bin/Debug/list_link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_link/bin/Debug/list_link.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/in.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 7 4 3 | 5 0 4 | 4 1 5 | 3 2 6 | 6 3 7 | 3 8 | 7 0 9 | 5 2 10 | 6 1 -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/list_link.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/list_link.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_link/list_link.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/list_link.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_link/list_link.h -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/list_link.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_link/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/list_link/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/list_link/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/Queue.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/Queue.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_array/Queue.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/Queue.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/bin/Debug/Queue.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_array/bin/Debug/Queue.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_array/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_array/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_array/queue.h: -------------------------------------------------------------------------------- 1 | //file:queue.h 2 | #ifndef _Queue_H_INCLUDE_ 3 | #define _Queue_H_INCLUDE_ 4 | #define N 10002 5 | #include 6 | template 7 | class Queue 8 | { 9 | public: 10 | Queue():frount(1),rear(1) {} 11 | void push(T t); 12 | void pop(); 13 | T front(); 14 | bool empty(); 15 | private: 16 | int frount,rear; 17 | T Q[N]; 18 | }; 19 | template 20 | bool Queue::empty() 21 | { 22 | if(frount==rear) return true; 23 | else return false; 24 | } 25 | template 26 | T Queue::front() 27 | { 28 | if (!empty()) return Q[frount]; 29 | else {printf("Empty!\n");} 30 | } 31 | template 32 | void Queue::pop() 33 | { 34 | if(!empty()) frount++; 35 | else printf("Empty!\n"); 36 | } 37 | template 38 | void Queue::push(T t) 39 | { 40 | Q[rear]=t; 41 | rear++; 42 | } 43 | #endif // _STACK_H_INCLUDE_ 44 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/bin/Debug/queue_link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_link/bin/Debug/queue_link.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_link/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_link/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/queue_link.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/queue_link.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_link/queue_link.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/queue_link.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/queue_link/queue_link.h -------------------------------------------------------------------------------- /hit_ds_code/线性表/queue_link/queue_link.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/bin/Debug/stack.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_array/bin/Debug/stack.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_array/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/mystack.h: -------------------------------------------------------------------------------- 1 | //file:mystack.h 2 | #ifndef _MYSTACK_H_INCLUDE_ 3 | #define _MYSTACK_H_INCLUDE_ 4 | #define N 10002 5 | template 6 | class Stack 7 | { 8 | public: 9 | Stack():stack_top(0) {} 10 | void push(T t) 11 | { 12 | s[stack_top++] = t; 13 | } 14 | void pop() 15 | { 16 | stack_top--; 17 | } 18 | T top() 19 | { 20 | return s[stack_top-1]; 21 | } 22 | bool empty() 23 | { 24 | return stack_top == 0; 25 | } 26 | private: 27 | int stack_top; 28 | T s[N]; 29 | }; 30 | #endif // _STACK_H_INCLUDE_ 31 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_array/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/stack.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/stack.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_array/stack.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_array/stack.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/bin/Debug/stack_link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_link/bin/Debug/stack_link.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_link/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_link/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/stack_link.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/stack_link.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/stack_link/stack_link.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/stack_link.h: -------------------------------------------------------------------------------- 1 | //file:stack_link.h 2 | #ifndef STACK_LINK_H_INCLUDED 3 | #define STACK_LINK_H_INCLUDED 4 | template 5 | class node 6 | { 7 | public: 8 | T data; 9 | node* next; 10 | node():next(NULL) {}; //No-arg constructor 11 | node(T p)//Constructor 12 | { 13 | this->data=p;//"this" means "class node" 14 | next=NULL; 15 | }; 16 | }; 17 | template 18 | class stack 19 | { 20 | public: 21 | stack(); 22 | bool empty(); 23 | void push(T x); 24 | void pop(); 25 | T top(); 26 | private: 27 | node* L; 28 | }; 29 | template 30 | stack::stack() 31 | { 32 | L=new node; 33 | L->next=NULL; 34 | }; 35 | template 36 | bool stack::empty() 37 | { 38 | if(L->next==NULL)return true; 39 | else return false; 40 | } 41 | template 42 | void stack::push(T x) 43 | { 44 | node* s=new node; 45 | s->data=x; 46 | s->next=L->next; 47 | L->next=s; 48 | } 49 | template 50 | void stack::pop() 51 | { 52 | node* s=L->next; 53 | if(!empty()) 54 | { 55 | L->next=s->next; 56 | delete s; 57 | } 58 | } 59 | template 60 | T stack::top() 61 | { 62 | if(L->next) return L->next->data; 63 | else ; 64 | } 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/stack_link/stack_link.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/bin/Debug/static_state_link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/static_state_link/bin/Debug/static_state_link.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/static_state_link/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/static_state_link/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/static_state_link.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/static_state_link.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/static_state_link/static_state_link.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/static_state_link.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/static_state_link/static_state_link.h -------------------------------------------------------------------------------- /hit_ds_code/线性表/static_state_link/static_state_link.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/bin/Debug/三元组顺序表.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/三元组顺序表/bin/Debug/三元组顺序表.exe -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/三元组顺序表/main.cpp -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/三元组顺序表/obj/Debug/main.o -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/threemat.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/三元组顺序表/threemat.h -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/三元组顺序表.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 44 | 45 | -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/三元组顺序表.depend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acpipe/HIT_DS/2c9923717b9e4753c7f66173d979fb302abd9b99/hit_ds_code/线性表/三元组顺序表/三元组顺序表.depend -------------------------------------------------------------------------------- /hit_ds_code/线性表/三元组顺序表/三元组顺序表.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | --------------------------------------------------------------------------------