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 6917893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:47:21+00:00 2026-05-27T09:47:21+00:00

Given an array [x1, x2, x3, …, xk ] where xi is the number

  • 0

Given an array [x1, x2, x3, …, xk ] where xi is the number of items in box i,
how can I redistribute the items so that no box contains more than N items. N is close to sum(xi)/k — That is, N is close to every box having the same number of items. Intermediate boxes shouldn’t be used to carry items — if x1 has a surplus and x2 and x3 have deficits, x1 should send some items to x2 and to x3, but not send all its items to x2 and then let x2 resolve the surplus.

The actual problem is: each computing node has a set of samples, and after a resampling step some computer nodes might have a surplus while others have a deficit, so I’d like to re-distribute the samples while minimizing communication.

I imagine this sort of problem has a name.

  • 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-27T09:47:22+00:00Added an answer on May 27, 2026 at 9:47 am

    This problem could be modeled as an instance of minimum-cost flow.

    Let G be a directed graph with vertices s, t, a1, …, ak, b1, …, bk and arcs s→ai of capacity xi and cost 0, arcs ai→bj of infinite capacity and cost 0 if i = j and cost 1 if i ≠ j, and arcs bj→t of capacity N and cost 0. We want the minimum-cost flow that moves ∑i xi units from s to t. The idea is that if y units flow ai→bj, then y items are moved from box i to box j (if i ≠ j; if i = j, then no move occurs).

    Using minimum-cost flow to solve this simple problem is of course using a sledgehammer to crack a nut, but several variants can be modeled as network flow problems.

    • If a pair of nodes i, j is not directly connected, remove the ai→bj arc.

    • We can start up and shut down nodes by giving them vertices on only the “a” side or the “b” side.

    • We can model differences in communication speeds by adjusting the costs from uniform.

    • We can limit the number of items two nodes exchange by limiting the capacity of their arc.

    • We can introduce more interior vertices and change the complete bipartite topology of the connections to model the effects of network contention.

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

Sidebar

Related Questions

How to find Min,Max,Sum of given array? int[] number = { 1, 2, 3,
Given an array of n integers, where one element appears more than n/2 times.
I need one liner (or close to it) that verifies that given array of
Given an array of items, each of which has a value and cost ,
We gave a given array which can be in 4 states. array has values
Given array a= [1,4,5,9,2].I need to find/print combinations of two values where sum =
I have the following script that dumps a given array's contents function dump(obj) {
How can I create a class with a given array of arguments to be
How to do that without having to scroll the entire given array with a
Start with an array of integers so that the sum of the values is

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.