Homework 6


Due : 11am, 16 July

Question 5.3 from the course text.

Solution

(a)
void inorder ( BinNode * rt )
{
   if (rt == NULL) return;
   inorder (rt->leftchild ());
   visit (rt);
   inorder (rt->rightchild ());
}
(b)
void postorder ( BinNode * rt )
{
   if (rt == NULL) return;
   postorder (rt->leftchild ());
   postorder (rt->rightchild ());
   visit (rt);
}

Last updated : 16 July 1999 8:04pm