Is there a name for this type of algorithm?

Posted by rehanift on Stack Overflow See other posts from Stack Overflow or by rehanift
Published on 2010-04-12T19:43:53Z Indexed on 2010/04/12 19:52 UTC
Read the original article Hit count: 239

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about matrix

Related posts about algorithm