I have a 2 dimensional array forming a table:
[color][number][shape ]
-------------------------
[black][10 ][square ]
[black][10 ][circle ]
[red ][05 ][triangle]
[red ][04 ][triangle]
[green][11 ][oval ]
and what I want to do is group largest common denominators, such that we get:
3 groups
- group #1: color=black, number=10, shapes = [square, circle]
- group #2: color=red, shape=triange, numbers = [05,04]
- group #3: color=green, number=11, shape = oval
I wrote code that will handle a 2 "column" scenario, then I needed to adjusted it for 3 and I was figuring I might as well do it for n. I wanted to check first if there is some literature around this but I can't think of what to start looking for!