#2
azzbcc2015-02-11 09:12
|
我是这样想的:
从一个口令中获取到其中的数字部分
用广度搜索的办法建一个树
程序代码:
程序代码:
struct num{int number;num *NEXT[10];};header[10]={0,NULL......};
for(int i=0;i<10;i++)
header.NEXT=NULL;
......
source[10]//这里存的是一个口令中的数字部分,假设都是10个数字
......
num *temp=header;
for(int i=0;i<10;i++)
{
if((temp+source[i])==NULL)
{
temp.NEXT[source[i]]=malloc(sizeof(num *));
给0给NULL;
}
temp=NEXT[source[i]];
temp.number++;
}
......
for(int i=0;i<10;i++)
header.NEXT=NULL;
......
source[10]//这里存的是一个口令中的数字部分,假设都是10个数字
......
num *temp=header;
for(int i=0;i<10;i++)
{
if((temp+source[i])==NULL)
{
temp.NEXT[source[i]]=malloc(sizeof(num *));
给0给NULL;
}
temp=NEXT[source[i]];
temp.number++;
}
......
我的大体思路是这样,大家帮忙看看有没有什么问题。
现在的主要问题是,如果按照这样处理数据,占用的空间太大了,内存不够,怎么办