91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 115KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-22
  • 語言: 其他
  • 標簽:

資源簡介

數據結構課設Trie樹 聲明本程序版權歸guoxiang所有任何人不得商用,只供學習

資源截圖

代碼片段和文件信息

/*?
?*?File:???main.cpp
?*?Author:?GuoXiang
?*聲明本程序版權歸guoxiang所有任何人不得商用,只供學習
?*?Created?on?2009年12月10日?下午12:22
?*/

#include?
#include
#include
#include?
#include
#include
using?namespace?std;
const?int?LenChild=26;
const?int?Max_Word_Len=30;
const?int?Max_Word_Information_Len=300;
typedef?class?node{
????bool?has;
????node?*?child[LenChild];
????string?*?inf;
????friend?class?TREE;
public:
????node(){
????????has=false;
????????inf=NULL;
????????for(int?i=0;i????}
????~node(){
????????????delete?inf;
????}
????string?*?getinf(){
????????return?inf;???
????}
}node*tree;

class?TREE{
????tree?T;
public:
????TREE(){
????????T=new?node;;
????}
????void?clear(node?*p){
????????for(int?i=0;i????????????if(p->child[i])?clear(p);????
????????}?
????????delete?p;
????}
????~TREE(){
???????clear(T);?????
????}
????bool?Insert_word(char?*wordchar?*ch){
????????int?i=0;?node?*p=T;
????????while(word[i]){
????????????int?index=word[i]-?‘a‘;
????????????if(!p->child[index]){
????????????????p->child[index]=new?node;
????????????}
????????????p=p->child[index];
????????????i++;
????????}
????????p->has=true;
????????p->inf=new?string(ch);
????????return?true;
????}

????bool?has_word(char?*wordtree?&the){
????????int?i=0;?node?*p=T;
????????while(word[i]){
????????????int?index=word[i]-?‘a‘;
????????????if(!p->child[index])?break;
????????????p=p->child[index];
????????????i++;
????????}
????????the=p;
????????return?p->has?&&?i==strlen(word);
????}

????bool?delete_word(char?*word){
????????int?i=0;?node?*p=T;
????????while(word[i]){
????????????int?index=word[i]-?‘a‘;
????????????if(!p->child[index])?break;
????????????p=p->child[index];
????????????i++;
????????}
?????????if(p->has?&&?i==strlen(word)){
?????????????delete?p->inf;
?????????????p->has=false;?return?true;
?????????}
?????????else?{?return?false;}

????}
????void?dfs(tree?pstring?*w[]node?*ans[]int?&?Countchar?*eint?len){
??????????if(Count>=8)return;
??????????e[len]=‘\0‘;
??????????if(p->has){
??????????????ans[Count]=p;
??????????????w[Count++]=new?string(e);????????
??????????}????
??????????for(int?i=0;i??????????????if(p->child[i]){
??????????????????e[len]=i+‘a‘;
??????????????????dfs(p->child[i]wansCountelen+1);?????????????
??????????????}????
??????????}
????}
????void?Find_word(char?*wordstring?*w[]node?*ans[]int?&?Count){
????????char?e[Max_Word_Len];
????????int?i=0len=0;?node?*p=T;
????????while(word[i]){
????????????int?index=word[i]-?‘a‘;
????????????e[len++]=word[i];
????????????if(!p->child[index])?break;
????????????p=p->child[index];
????????????i++;
????????}
????????if(?i==strlen(word)){
????????????dfs(pwansCountelen);
????????}
???????
????}
????void?Creat(){
???????system(“cls“);
???????cout<

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????10753??2010-01-03?11:57??file.cpp

?????文件?????510383??2009-12-13?17:51??file.exe

?????文件??????????0??2009-12-28?17:07??word.data

-----------?---------??----------?-----??----

???????????????521136????????????????????3


評論

共有 條評論

相關資源