Help needed in c programming for data structure and algorithm

CSE 3318 Lab Assignment 3

Due March 27

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 partition (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. cut-and-paste. 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. The dynamic programming table should be

output when m/3 < 10, but in no other cases. Error messages should be displayed if m is not divisible
by 3 or if the problem instance does not have a solution. When a solution exists, it should be
displayed with each subsequence in a separate column:

i 0 1 2
1 10
2 20
3 30
4 40
5 40
6 50
7 80

2. Submit your C program on Canvas by 3:45 p.m. on Wednesday, March 27. One of the comment lines

should include the compilation command used on OMEGA (5 point penalty for omitting this).
Another comment should indicate the asymptotic worst-case time in terms of m and n.

Getting Started:

1. If you wanted two sequences summing to m/2, then the backtrace part of subsetSum.c could easily

be modified. By finding one subsequence that sums to m/2, the remaining elements would be another
subsequence that sums to m/2. Similarly, your program should use dynamic programming to find two
subsequences that each sum to m/3 and then take the leftover values as the third subsequence. Thus,
this is a two-dimensional DP situation, not one-dimensional like ordinary subset sums in Notes 7.F.

2. Dynamic programming is the only acceptable method for doing this lab.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more