2012年6月3日

摘要: View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 26typedef struct Node{ int isword; struct Node *next[MAX];}Trie;void InsertTree(Trie *root,const char *s);int searchTree(Trie *root,const char *s);void deleteTree(Trie *root);void InsertTree(Trie *root,co 阅读全文
posted @ 2012-06-03 21:49 蓝色守望 阅读(178) 评论(0) 推荐(0)
摘要: View Code #include <stdio.h>void perfix(char P[],int U[],int lenP);void match(char T[],char P[],int U[],int lenT,int lenP);void perfix(char P[],int U[],int lenP){ U[0]=-1; int k=-1; int i=1; for(;i<lenP;i++){ while(P[k+1]!=P[i]){ if(k==-1) break; k=U[k]; ... 阅读全文
posted @ 2012-06-03 13:25 蓝色守望 阅读(153) 评论(0) 推荐(0)
摘要: 动态规划的主旨是以空间换时间,就是为了避免重复计算,把第一次计算的结果保存起来。最优子结构是使用动态规划的标志之一;另一个标志是子问题的重叠性。动态规划其实就是一个动态的递归,一个递归式和一个终止条件。 阅读全文
posted @ 2012-06-03 10:15 蓝色守望 阅读(250) 评论(0) 推荐(0)

导航