I have a 3-tier menu system in that there are 3 levels such that each top-level menu item has X mid-level items and each mid-level item has Y bottom-level items.
For each top-level item I need to split the mid-level and bottom-level items into 3 columns as equally as possible with the restriction that I cannot split the children of a mid-level item into 2+ columns. If I didn't have to keep all the children of a mid-level item together, making equal columns would be pretty much as simple as diving the total number of children in a top level item by 3. However, since I need to group the children of all mid-level items, this seems to become less trivial.
For example - 3 columns of equal length:
| Mid 1 | Mid 2 | Mid 3 | | -Bottom 1-1 | -Bottom 2-1 | -Bottom 3-1 | | -Bottom 1-2 | -Bottom 2-2 | -Bottom 3-2 | | -Bottom 1-3 | -Bottom 2-3 | -Bottom 3-3 | | -Bottom 1-4 | -Bottom 2-4 | -Bottom 3-4 |
And 3 unequal columns:
| Mid 1 | Mid 2 | Mid 4 | | -Bottom 1-1 | -Bottom 2-1 | -Bottom 4-1 | | -Bottom 1-2 | Mid 3 | -Bottom 4-2 | | -Bottom 1-3 | -Bottom 3-1 | -Bottom 4-3 | | -Bottom 1-4 | -Bottom 3-1 | |
I'm not looking for code, I'm just looking for an idea on how to approach this conceptually.