I have several lists:
A = [\"a0\", \"a1\"] // the number of lists varies
B = [\"b0\", \"b1\", \"b2\"] // such as the number of elements in a list.
C = [\"c
OK. I think you actually mean that you want to find every path from root to a leaf.
Then (a un-optimized version)
void traverse (Node root) {
// assume root != NULL
traverse (root, new LinkedList());
}
private void traverse (Node root, LinkedList path) {
path.add(root);
if (root.isLeaf()) {
print path;
}
else {
for each node of root {
traverse (node, new LinkedList(path));
}
}
}