I have a tree represented as Set<Integer>[]
Next one Set<Integer>[]:
[ { 1 }, { 2, 3 }, { 4 }, { 5, 6, 7 } ]
represents the following tree:
1
/ \
/ \
/ \
2 3
| |
4 4
/|\ /|\
5 6 7 5 6 7
Thus, each level in the tree is encoded as Set. All children at a certain level in the tree are the same. The first set may contain several integers.
I want to get from the Set<Integer>[]list of all paths from root to leaves:
[ [ 1, 2, 4, 5 ], [ 1, 2, 4, 6 ], [ 1, 2, 4, 7 ], [ 1, 3, 4, 5 ], [ 1, 3, 4, 6 ], [ 1, 3, 4, 7 ] ]