示例#1
0
void tinorder(threadedPointer tree) {
	threadedPointer temp = tree;
	for (;;)
	{

		temp = insucc(temp);
		if (temp == tree) break;
		printf("%3c", temp->data);
	}
	printf("\n");
}
示例#2
0
void insort(linktyp *lp, headtyp *hp, int (*is_less)(datatyp d1, datatyp d2))
/* Sätter in länken sorterad enligt is_less */
{
   linktyp *sp, *ep;

   newlink(&sp);
   *sp = *lp;
   infirst(sp, hp);
   ep = lastlink(hp);
//   if(ep == NULL) return;
   while ( is_less(lp->data, ep->data) )
      ep = predlink(ep);
   insucc(lp, ep);
   elimlink(&sp);
}
示例#3
0
void insertRight(threadedPointer s, threadedPointer r)
{
	threadedPointer temp;
	r->rightChild = s->rightChild;
	r->rightThread = s->rightThread;
	r->leftChild = s;
	r->leftThread = TRUE;
	s->rightChild = r;
	s->rightThread = FALSE;
	if (!r->rightThread)
	{
		temp = insucc(r);
		temp->leftChild = r;
	}

}