摘要: // // 二叉树的建立与先序遍历// #include <iostream>#include <malloc.h>using namespace std; typedef struct BiTreeNode { char elem; struct BiTreeNode *lchild, *rchi 阅读全文
posted @ 2017-02-22 21:18 codingtao 阅读(319) 评论(0) 推荐(0) 编辑
摘要: // // 求串S中出现的第一个最长重复字串及其位置// #include <iostream>#include <string>using namespace std; // KMP算法中,next数组所存的是,在第j个字符前存在一个长度为next[j]-1的重复子串// 重复子串:SubStri 阅读全文
posted @ 2017-02-22 20:59 codingtao 阅读(2316) 评论(0) 推荐(0) 编辑
摘要: // // KMP算法求目标串是否是源串的子串// 是 返回position// 否 返回-1// #include <iostream>#include <string> using namespace std; void GetNext(string s, int next[], int len 阅读全文
posted @ 2017-02-22 19:42 codingtao 阅读(399) 评论(0) 推荐(0) 编辑
摘要: // 邻接表存储与广度和深度优先算法#include <iostream> using namespace std; #define MAX_VERTEX_NUM 100 typedef enum { DG,DN,UDG,UDN}GraphKind; typedef struct EdgeNode 阅读全文
posted @ 2017-02-22 18:38 codingtao 阅读(6286) 评论(0) 推荐(0) 编辑
摘要: // 哈夫曼编码/译码系统 #include <iostream>#include <string>#include <vector>using namespace std; // 统计字符信息中出现的字符种类数和各字符出现的次数(频率)typedef struct charNode { char 阅读全文
posted @ 2017-02-22 16:40 codingtao 阅读(557) 评论(0) 推荐(0) 编辑
摘要: // 图的存储和遍历 #include <iostream>using namespace std; // // 邻接矩阵的存储以及深度和广度优先遍历// // 邻接矩阵的存储定义#define MAX 10000000#define MAX_VERTEX_NUM 100 typedef enum 阅读全文
posted @ 2017-02-22 16:38 codingtao 阅读(479) 评论(0) 推荐(0) 编辑