Python Forum
Dividing list into subsets
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dividing list into subsets
#1
A list is given. You know the number of sticks with which we divide our list into subsets. The rules of division is that the sum of elements in each part should be approximately the same(so that the mininum sum of elements would be as big as possible). Then the programm should print the minimum of that sums.
For example:
Input:
4 (is a number of sticks) (so the list would be divided into three parts)
2 4 4 5 5 8 (the list itself)
Output:
8
Explanation: first we put stick before the first element, another stick at the end of the list(after 8). Then third stick between 4 and 5 , and the fourth between 5 and 8.
Can't think of an algorithm that would perform that task Cry .
Reply


Messages In This Thread
Dividing list into subsets - by Michael11 - Oct-01-2020, 12:26 PM
RE: Dividing list into subsets - by deanhystad - Oct-01-2020, 09:08 PM
RE: Dividing list into subsets - by Michael11 - Oct-02-2020, 06:43 AM
RE: Dividing list into subsets - by deanhystad - Oct-02-2020, 10:34 PM
RE: Dividing list into subsets - by DPaul - Oct-04-2020, 09:47 AM
RE: Dividing list into subsets - by Michael11 - Oct-04-2020, 10:23 AM
RE: Dividing list into subsets - by DPaul - Oct-04-2020, 05:13 PM
RE: Dividing list into subsets - by Katenn - Oct-04-2020, 06:13 PM
RE: Dividing list into subsets - by DPaul - Oct-05-2020, 06:34 AM
RE: Dividing list into subsets - by deanhystad - Dec-11-2020, 09:51 PM
RE: Dividing list into subsets - by deanhystad - Dec-12-2020, 06:18 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020