cutreeIntoOrderedGroups function

Cut a tree into groups of ordered sizes