📄 字典.cpp
字号:
#include <stdio.h>
#include <malloc.h>
typedef struct tire
{
struct tire *next[26];
char date;
int cnt;
}*_tire;
void init_tire(_tire root, char *string)
{
_tire s;
s=root;
while(*string!=’\0’)
{
if(s->next[*string - ’a’]==NULL)
{
s->next[*string - ’a’] = (_tire)malloc(sizeof(struct tire));
(s->next[*string - ’a’])->date = *string;
s = s->next[*string - ’a’];
for(int i=0;i<26;i++)
{
s->next[i] = NULL;
}
}
else
{
s = s->next[*string - ’a’];
}
string++;
}
s->cnt=1;
}
void print(_tire root, char *s, int i)
{
int j;
s[i] = root->date;
if(root->cnt==1)
{
s[i+1] = 0;
puts(s);
}
for(j=0;j<26;j++)
{
if(root->next[j]!=NULL)
{
print(root->next[j],s,i+1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -