随笔分类 - 数据结构实例
摘要:1.#include <stdio.h>#include <stdlib.h>#include "Hash.h"/* 哈希技术的实现 */struct Student{ char* id; char* name; int age;};int compare_id(HashKey* k1, HashK
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "BSTree.h"/* 二叉树排序算法 */struct Node{ BSTreeNode header; char v;};void printf_data(BSTreeNode* node){ if
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <time.h>#define SIZE 20//打印数组void println(int array[], int len){ int i = 0; for(i=0; i<len; i++) { print
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>#include <time.h>#include "SeqList.h" //调用库函数#define SIZE 20/* 打印数组 */void print_array(int a[], int len){ int i =
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>/* Floyd算法 */#define VNUM 5#define MV 65536int P[VNUM][VNUM];int A[VNUM][VNUM];int Matrix[VNUM][VNUM] ={ {0, 10,
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>/* Dijkstra算法 */#define VNUM 5#define MV 65536int P[VNUM]; //保存最短路径int Dist[VNUM];int Mark[VNUM];int Matrix[VNUM]
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>/* 最小路径算法 --》prim算法 */#define VNUM 9#define MV 65536int P[VNUM];int Cost[VNUM];int Mark[VNUM]; //标记数组int Matrix[V
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "LGraph.h"/* run this program using the console pauser or add your own getch, system("pause") or input
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "MGraph.h"/* run this program using the console pauser or add your own getch, system("pause") or input
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "Graph.h"/* 图的定义 */int main(int argc, char *argv[]){ Graph* graph = Graph_Create(5); Graph_AddEdge(gra
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "BTree.h"#include "SeqList.h"/* 线索二叉树 */struct Node{ BTreeNode header; char v;};void printf_data(BTree
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "BTree.h"#include "LinkQueue.h"/* 主方法 */struct Node{ BTreeNode header; char v;};void printf_data(BTree
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "BTree.h"/* run this program using the console pauser or add your own getch, system("pause") or input
阅读全文
摘要:1.#include <stdio.h>#include "GTree.h"/* 主方法 测试 */void printf_data(GTreeData* data){ printf("%c", (int)data);}int main(int argc, char *argv[]){ //创建一棵
阅读全文
摘要:1. #ifndef _TREE_H_#define _TREE_H_ typedef void Tree;typedef void TreeNode; /* 创建树 */Tree* Tree_Create(); /* 销毁已存在的树 */void Tree_Destroy(Tree* tree);
阅读全文
摘要:1.希尔算法: #include <stdio.h>/* 希尔排序算法实现--但有时不稳定 */void println(int array[], int len){ int i = 0; for(i=0; i<len; i++) { printf("%d ", array[i]); } print
阅读全文
摘要:1.冒泡: #include <stdio.h>/* 冒泡排序算法实现 */void println(int array[], int len){ int i = 0; for(i=0; i<len; i++) { printf("%d ", array[i]); } printf("\n");}v
阅读全文
摘要:1.#include <stdio.h>/* 实现多关键字排序 */typedef struct _tag_DataElem{ char desc[20]; int key1; int key2;} DataElem;int compare1(DataElem* ld, DataElem* rd){
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "SQueue.h"/* run this program using the console pauser or add your own getch, system("pause") or input
阅读全文
摘要:1.#include <stdio.h>#include <stdlib.h>#include "LinkQueue.h"/* run this program using the console pauser or add your own getch, system("pause") or in
阅读全文