Trie字典树
1 #include "stdio.h" 2 #include "iostream" 3 #include "malloc.h" 4 #include "string.h" 5 6 using namespace std; 7 8 #define MAX_SIZE 26 9 10 typedef struct Trie{ 11 char val; 12 bool isword; 13 struct Trie* child[MAX_SIZE]; 14 }Node,*Trie_pointer; 15 16 Trie_pointer CreateNode() 17 { 18 Trie_pointer node; 19 node = (Trie_pointer)malloc(sizeof(Node)); 20 memset(node,0,sizeof(0)); 21 return node; 22 } 23 24 void Insert(Trie_pointer root, char *s) 25 { 26 Trie_pointer tmp,t = root; 27 char *p = s; 28 if(*s == '