Ejemplo n.º 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);
}
Ejemplo n.º 2
0
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");
}