예제 #1
0
SummUnit::SummUnit(SummNode* source, bool truncated, bool exceptions) {
    this->source    = source;
    this->words     = source->words;
    this->refs      = source->refs;
    this->truncated = truncated;
    this->exceptions= exceptions;

    if(source->parent!=0) prependChar(source->c);
}
예제 #2
0
파일: Test.c 프로젝트: iMuduo/CommLib
main()
{
	int i;
	tHuffList *list=CreateHuffList();
	tHuffEm em,*result;
	time_t t=time(NULL);
	em.val=NULL;
	srand(t);
	for (i=0;i<100;i++)
	{
		em.cost=rand();
		em.val=prependChar(em.val,33+i);
		PutHuffNode(list,&em);
		em.val=NULL;
	}
	result=CalcHuffCode(list);
	for (i=0;i<100;i++)
	{
		printf("cost: %-6d ----- HuffCode:%-20s\n",result[i].cost,result[i].val);
	}
	system("pause");
}