``I must give him his due. He has considerably cretinized me.'' Lautréamont

Pics click to enlarge.

Sunday, December 25, 2011

Xmas Code

Free a tree into a freelist linked by left node, without recursion:


freetree(t)
struct node *t;
{
struct node **p,*sv;
sv=freelist; freelist=0; p=&freelist;
for(*p=t; *p; p=&p[0]->left);
while(t) {
for(*p=t->right; *p; p=&p[0]->left);
t=t->left;
}
*p=sv;
}

Followers

Blog Archive