This preview shows page 1. Sign up to view the full content.
CSE 2320 Lab Assignment 3
Due November 14, 2011
Goal:
1.
Understanding of dynamic programming.
2.
Understanding of subset sums.
Requirements:
1.
Design, code, and test a C program that uses
dynamic programming
to separate (if possible) a
sequence of
n
positive integers into three subsequences such that the sum of each subsequence is the
same.
For example, if the input were (10, 20, 30, 40, 40, 50, 80), with a total of
m
= 270, the three
m
/3 = 90 subsequences could be (10, 80), (20, 30, 40), and (40, 50).
If the input were (20, 20, 30, 50),
then no solution is possible even though the values yield a sum (
m
= 120) divisible by 3 (
m
/3 = 40).
The input should be read from standard input (which will be one of 1. keyboard typing, 2. a shell
redirect (<) from a file, or 3. cutandpaste.
Do NOT prompt for a file name!).
The first line of the
input is
n
, the length of the sequence.
Each of the remaining lines will include one sequence value.
Your program should echo the input sequence in all cases.
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 03/25/2012 for the course CSE 2320 taught by Professor Bobweems during the Spring '12 term at UT Arlington.
 Spring '12
 BOBWEEMS
 C Programming

Click to edit the document details