00001 /* 00002 * rmtree.C: recursively deletes a node together with all of its offspring 00003 *............................................................................. 00004 * version 1: Nov 1994 Piet Hut 00005 *............................................................................. 00006 */ 00007 #include "node.h" 00008 00009 void rmtree(node* b, 00010 bool delete_b) // default = true 00011 { 00012 node* d = b->get_oldest_daughter(); 00013 while (d) { 00014 node* tmp = d->get_younger_sister(); 00015 rmtree(d); 00016 d = tmp; 00017 } 00018 00019 if (delete_b) delete b; // optionally leave node itself untouched 00020 } 00021 00022 /* endof: rmtree.c */