You are given a sequence of n integers and an integer k such that 1< k< n. The goal is to partition the sequence into k contiguous subsequences such that the largest sum of the numbers in any subsequence is minimized. Design a dynamic programming algorithm to find this minimum sum value as well as the partition that produces this minimum value. An example is given below. 1. Consider your 7 digit UH ID as a sequence of 7 integers. For example, if your UH ID is 3255967, then the sequence is 3, 2, 5, 5, 9, 6, 7. Let the given value of k be 3. Then, the best way to partition this particular sequence into 3 subsequences so that the largest subsequence sum is minimized is: {3,2, 5}{5,9}{6, 7} Note that the largest sum value is 5 + 9 = 14, attained by the second subsequence. Any other partition will increase the largest subsequence sum. What is the best way to partition your 7 digit UH ID sequence assuming k = 3? 2. Define the subproblems for your DP solution on a general instance of the problem where the sequence is of length n. Note that k is a fixed integer given as part of the input. 3. Give a recursive formulation, including the base cases, to solve this problem. 4. What is the running time of your solution? 5. Write a DP algorithm (give pseudocode) that outputs the minimum sum value. 6. Describe an algorithm to output the partition that corresponds to the minimum value.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

assuming ID is 1542553

UH ID:
You are given a sequence of n integers and an integer k such that 1< k<n. The goal
is to partition the sequence into k contiguous subsequences such that the largest sum of
the numbers in any subsequence is minimized. Design a dynamic programming algorithm
to find this minimum sum value as well as the partition that produces this minimum
value. An example is given below.
1. Consider your 7 digit UH ID as a sequence of 7 integers. For example, if your UH
ID is 3255967, then the sequence is 3, 2, 5, 5, 9, 6, 7. Let the given value of k be 3.
Then, the best way to partition this particular sequence into 3 subsequences so that
the largest subsequence sum is minimized is:
{3,2, 5}{5,9}{6, 7}
Note that the largest sum value is 5+ 9 = 14, attained by the second subsequence.
Any other partition will increase the largest subsequence sum.
What is the best way to partition your 7 digit UH ID sequence assuming k = 3?
2. Define the subproblems for your DP solution on a general instance of the problem
where the sequence is of length n. Note that k is a fixed integer given as part of the
input.
3. Give a recursive formulation, including the base cases, to solve this problem.
4. What is the running time of your solution?
5. Write a DP algorithm (give pseudocode) that outputs the minimum sum value.
6. Describe an algorithm to output the partition that corresponds to the minimum
value.
Transcribed Image Text:UH ID: You are given a sequence of n integers and an integer k such that 1< k<n. The goal is to partition the sequence into k contiguous subsequences such that the largest sum of the numbers in any subsequence is minimized. Design a dynamic programming algorithm to find this minimum sum value as well as the partition that produces this minimum value. An example is given below. 1. Consider your 7 digit UH ID as a sequence of 7 integers. For example, if your UH ID is 3255967, then the sequence is 3, 2, 5, 5, 9, 6, 7. Let the given value of k be 3. Then, the best way to partition this particular sequence into 3 subsequences so that the largest subsequence sum is minimized is: {3,2, 5}{5,9}{6, 7} Note that the largest sum value is 5+ 9 = 14, attained by the second subsequence. Any other partition will increase the largest subsequence sum. What is the best way to partition your 7 digit UH ID sequence assuming k = 3? 2. Define the subproblems for your DP solution on a general instance of the problem where the sequence is of length n. Note that k is a fixed integer given as part of the input. 3. Give a recursive formulation, including the base cases, to solve this problem. 4. What is the running time of your solution? 5. Write a DP algorithm (give pseudocode) that outputs the minimum sum value. 6. Describe an algorithm to output the partition that corresponds to the minimum value.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning