Dynamic Programming for partation and  backtracing CSE 3318 Lab Assignment 3 Due March 27 Goal: 1. Understanding of dynamic programming. 2.

Dynamic Programming for partation and  backtracing 

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.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

#1 Now is the time to be honest. After you

 #1 Now is the time to be honest. After you  have watched viewed the videos, describe yourself as a leader.  Don’t tell me what kind of leader you want to be, tell me about the  kind of leader you actually are – where you have strengths and  where you have

Banks impact the economy.

Instructions ABC Bank officials view compliance with regulations as a necessity for the very survival of their business. The leadership team at ABC also understands the impact that banks have on the aggregate economy, particularly the ramifications of mismanaged risks within banks. ABC’s leadership team believes that a holistic understanding

300words The Score was 4 In this unit’s study, you

300words The Score was 4 In this unit’s study, you completed the Adverse Childhood Experience  (ACE) Questionnaire. Your maximum score is a possible 10; however,  research shows that any score over three indicates risk for many of the behavioral and physical consequences related to ACE scores. You need not share your

This module provides abundant examples of how humanities influence creative

This module provides abundant examples of how humanities influence creative expression. Everything not found in nature makes up our culture, and all of those cultural artifacts are touched by humanities. Everything we encounter that is made by humans is both part of our culture and part of human expression. This

For this second discussion board read the article with the

For this second discussion board read the article with the link above entitled  Bonobos Sex & Society by Frans de Waal. After reading the article post a thread of a minimum of two paragraphs. Summarize the key points you consider most important. Cite two or three key facts or ideas from the

Research social responsibility issues in the countries of operation of

Research social responsibility issues in the countries of operation of Mcdonald’s  and analyze:- 1) how the organization is or is not addressing these.   2) Identify recommendations for enhancement of these in development activities. This is going to be a slide presentation with robust, scholarly slide notes (in text and

Alvis Corporation

Write a 3-4 page paper in APA format (not including the cover page and reference page). Below is a recommended outline. Please use the APA Sample provided in Unit 1 to complete your assignment. Locate two contemporary (2013 or more recent) journal articles apply to the leadership theories in this

Assignment Instructions: Be sure to review the attached rubric that

Premium Paper Help is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.

Requirements: Choose one research topic from “Online Sources and Research

Requirements: Choose one research topic from “Online Sources and Research Topics” 5. Research Paper Each student will submit a research paper on a topic of their choosing that is theological in nature. The research paper will be 7 pages in length, double-spaced, paginated, Times New Roman 12-point font, have standard

– In the article, “A review paper on big data

–  In the article, “A review paper on big data and data Mining: Concept and Techniques,” the authors discuss large data, techniques for accessing it, and the processes of data mining. The authors introduce significant challenges to data mining larger amounts of data.  –  This paper is to be a

CASE STUDY: Brad is a production engineer at a bicycle

CASE STUDY:  Brad is a production engineer at a bicycle company. Part of his job includes inspecting broken bikes and drafting the design plans for their repair. One day, Brad receives instructions from his supervisor to repair a bike whose brake cables had snapped. When Brad inspects the bike, he

Reflect on a team you have been a part of,

 Reflect on a team you have been a part of, either in the workplace or in your personal life. In reviewing the team dynamics, describe a time when you were a part of a team. Which role(s) did you exhibit and why? In hindsight, would you change any aspect of