I have a table in which each record represents an account. Within each record is a number of contracts that is associated with this account, along with the total dollar value of these contracts.
What I need to do is to assign a bucket to each of these records so that the number of accounts and the total dollars in each bucket is as equal as possible. The number of buckets will be supplied by the user. (It will likely range from 1 (yay, easy!) to 10 or so.)
I'm not looking for all of the code involved, just a general pointer so that I can do this with as little error rate as possible.
Any suggestions would be most welcome!