Suppose there is a tree, for argument's sake an XML tree. And you want a complete set of root to node paths, however you want to divide that set into groups of i, where i is user specified.
So for example a html document:
/html
/html/head
/html/head/title
/html/head/title/[text]
/html/body
/html/body/[text]
becomes for example when i is 3:
{{1, 11, 111}, {1111, 12, 121}}
then becomes for example:
{3, 4}
Using a simplified tree class that can only get the node name; get an ArrayList of subtrees; and check if it is a leaf node; What is the best way to build this set of hashes?
EDIT: See my sample solution answer below, this is far from optimal as it is very slow and perhaps not even the best approach.