随笔分类 - 数据结构
摘要:#include #include #include #include #include #include using namespace std; typedef struct LNode{ int data; struct LNode *next,*prior; }LNode,*LinkList; //头插法 (顺序与输入顺序相反) void CreatList1(...
阅读全文
摘要:字典树又叫trie树,利用字符串的公共前缀来降低查询时间的开销,以及字符串的存储开销。所以经常被搜索引擎系统用于文本词频统计。 字典树的数据结构 #define MAX 26 typedef struct Tree { int count; //用来标记该节点是个可以形成一个单词,如果count!=
阅读全文
摘要:#includeusing namespace std;int A[]={0,4,1,3,2,16,9,10,14,8,7};int left(int i){ return 2*i;}int right(int i){ return 2*i+1;}int parent(int i){ ...
阅读全文
摘要:#include#includeusing namespace std;/*二叉树的前序遍历,按照 根节点->左孩子->右孩子*/typedef struct node{ char data; struct node *lchild,*rchild;}BinTree;void crea...
阅读全文

浙公网安备 33010602011771号