Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : RECURSE.C

 
Output of file : RECURSE.C contained in archive : PJ91.ZIP
/* Consider in C: */

struct tree {
char info;
struct tree *left;
struct tree *right;
} node;

typedef struct tree TREE;

TREE *stree(TREE *root, TREE *cur, char info){
if (!cur){
if (!(cur = malloc(sizeof(node))) {
printf("Out of memory\n");
exit(0);
}
cur->left = cur->right = 0;
if (infoinfo)
root->left = cur;
else
root->right = cur;
return cur;
}
if (infoinfo)
stree(cur,cur->left,info); /* to left */
else if (info>cur->info)
stree(cur,cur->right,info); /* to right */
}


@CODE = void dfo( TREE *root ) {
if (!root)
return;
dfo(root->left);
printf("info --> %c ",root->info);
dfo(root->right);
}

void initialize_tree(void){
while (!done)
stree(root,get_next_node(),info)
dfo(root);
}



  3 Responses to “Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : RECURSE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/