So here's an attempt at a traversing algorithm. My apologies for the psuedo-code/C++ mixture here. My questions:

1. Have I got the recursion right?

2. Is this a relatively efficient algorithm?

Code:

initialize check_stack = NULL;
initialize assemblies;
boolean preorder(node x, check_stack)
{
check_stack.push(x);
if there are any repeats in check_stack
then
check_stack.pop();
return FALSE;
else
boolean check_children = TRUE;
for all y in x.children
{
check_children = check_children AND preorder(y, check_stack);
}
check_stack.pop();
return check_children;
end if
}
int main(void)
{
boolean all_checked_out = TRUE;
for all x in assemblies
{
all_checked_out = all_checked_out AND preorder(x, check_stack);
}
print(all_checked_out);
return 0;
}