0
$\begingroup$

i will try to be short. i need some "formula" or. a described way, how can i concat domains "together" so they dont touch?

in a example i will use letters instead of domains, i have:

A - gmail.com - 4 B - yahoo.com - 2 C - hotmail.com - 1 and thousand more 

now i need some algorithm, so domains wont be together, like:

A | B | A | C | A | B | A 

how can i accomplish that?


if letters must be togeter, let them be together as less as possible. another example is :

A - 10 B - 2 

bad example of concat:

AAAAABAAAAAB 

good example:

AAABAAABAAAA 
  • 0
    The problem is unclear. What makes AAABAAABAAA better than AAAAABAAAAAB? For what purpose are you concatenating them? Are you trying to find the shortest unambiguous string? Or is it about distributing the letters more evenly?2012-08-14
  • 0
    hey, tnx for fast reply. rule: concat same characters as little as possible. AAAAABAAAAAB has AAAAAx2 = A10. AAABAAABAAAA has AAAx2 and AAAAx1 = 10A. in first example, they are more A's together than in second example. imagine this: 99xA and 2xB. in this example it is better to have 33A+B+33A+B+33A than 45A+B+44A+B...2012-08-14

1 Answers 1