[mercury-users] good book question: most evenly balanced sum of permutations

Terrence Brannon princepawn at earthlink.net
Thu May 3 13:27:26 AEST 2001


Ok, here is a good question I would like to see a program for:

let's say a number is associated with each letter of the alphabet,
representing the number of students enrolled with that letter of the
first of their last name.

let's say we have a list of account managers, the number of which is
less than or equal to 20.

the goal of the program is to figure out the letters to assign to each
account manager such that the sum of students dealt with by each
manager is as close as possible to the amount dealt with by all
others.

example, just using 5 letters and 3 acct managers:

A - 5
B - 1
C - 2
D - 5
E - 4

acct mgr 1 => A,   (5)
acct mgr 2 => D,B  (6)
acct mgr 3 => E,C  (5)

I think this example will show why logic-functional programming has
some advantages of pure functional programs.


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list