Trees

Suppose you have a tree, with root node R and the you must paint every node in the tree red. You may only paint a node if you have painted its parent. How many ways are there of painting the tree.
Example, the tree:

4
\
2 3
\ /
1

Has got three ways of traversal:
1234
1243
1324

What is a general way to solve this problem?
Topic archived. No new replies allowed.