A sequence of integers is said to be bumpy when the signs of the differences between two
Fantastic news! We've Found the answer you've been seeking!
Question:
A sequence of integers is said to be bumpy when the signs of the differences between two consecutive terms in the sequence strictly alternate between and values. A difference of zero can never be part of a bumpy sequence. So the sequence either follows or it follows
An example of a bumpy sequence is On the other hand, the sequence is not bumpy because the differences between the three consecutive elements do not alternate. Two 5 ' " id="MathJax-Element-7-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">s also show up at the end of the sequence causing the consecutive difference to be zero.
You are given a sequence of integers
Your task is to find the length of the longest bumpy subsequence in A Design a dynamic programming algorithm to solve this problem.
Please answer the following parts:
Define the entries of your table in words. Eg Ti or Ti j is
State a recurrence for the entries of your table in terms of smaller subproblems. Don't forget your base cases
Write pseudocode for your algorithm to solve this problem.
State and analyze the running time of your algorithm.
Faster in asymptotic Big O notation and correct solutions are worth more credit.
Related Book For
Posted Date: