Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In a string of length n , the computational cost of splitting between index i and i + 1 ( indexed from 1 ) is
In a string of length
n the computational cost of splitting between index i and i indexed from is n for
any index i Call such an operation a split at i If you want to split your string into multiple
pieces, this means it matters what order you perform the splits in Formally:
Input: A string s s sn and split locations l l lk lk n
Note: We are defining l and lk for your convenience later.
Output: The smallest cost of splitting at l lk over all orderings of the splits.
Example: s axdf jkl l l This means we need to split the string s into
substrings a xdf and jkl If we start with the split at we incur a computational cost of
for the first split, plus for the second, for total. If we split at then instead, we incur
which is preferable.
Heres a helpful subproblem for this problem. Let OPTi j be the minimum cost of splitting
the substring sli slj at each of li lj Give a DP algorithm with detailed runtime.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started