Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 875333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:15:08+00:00 2026-05-15T11:15:08+00:00

So I’m working on a fun little program and ran across this rather interesting

  • 0

So I’m working on a fun little program and ran across this rather interesting problem:
I have several sets of values of pre-defined set sizes. These are all a unique subset of a larger pool of values. The averages of each subset of numbers should be as close to each other as reasonably possible. This does not need to be perfect, but should be close enough that all sets are “balanced” against each other.

ex: {1,2,3,6,9,10,15,23,27} global mean: 10.66
needs to be sorted into 2 sets of 2 and one set of 5

acceptable result:
{1,27}{2,23}{3,6,9,10}

In practice, the values will range between 60 and 200, and the sets will range from size 6 to 20.

I’ve tried a couple different algorithms, with various degrees of success, but I was interested in seeing what the good people at StackOverflow think.

My best,
Zach

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:15:09+00:00Added an answer on May 15, 2026 at 11:15 am

    This sounds interesting. would love to know whats the practical application of this.

    Just to be sure, guess you meant non intersecting subsets and sum of subsets be roughly equal (and not the averages)

    Also, in the example I couldn’t understand how you decided (for sure) to make 2 sets of 2 and one of 5.

    I can think of a greedy sub optimal solution.

    1. Sort the numbers decreasing order
      order. (smaller numbers surprise
      less so deal them later)
    2. Decide on the number of sets you are going to have. not too sure
      about this
    3. Go through the set elements one by one and put them into the subset
      which has the lowest sum (round
      robin in case of equal sums)

    This will not always give you the optimal solution though.

    For
    1,2,3,6,9,10,15,23,27
    reversed: 27, 23, 15, 10, 09, 06, 03, 02, 01

    27 3 2 1 = 33

    23 09 = 30

    15 10 06 = 31

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.