Ejemplo n.º 1
0
int init()
{
	int i, j, k;
	scanf("%d", &n); if(n == 0) return 0;
	scanf("%d", &k);
	p = e;
	for(i = 1;i <= n; i++) { list_a[i].next = NULL; list_t[i].next = NULL;}
	while(k--)
	{
		scanf("%d %d", &i, &j);
		insert_a(i, j);
		insert_t(j, i);
	}
}
Ejemplo n.º 2
0
int search_add(char *ch)
{
	node_a *temp=head;
	
	while(temp!=NULL)
	{
		if((temp->m[0]==*(ch+0))&&(temp->m[1]==*(ch+1)))
		{
			break;
		}
		temp=temp->down;
	}
	
	if(temp==NULL)
	{
		insert_a(ch);
		temp=p;
	}
	
	char st[2];
	st[0]=*(ch+2);
	st[1]=*(ch+3);
	insert_b(temp,st);
}