I need someone who can provide me algorithm problem solution in the given format, it will be time bounded, for e.g. after asking the problem I need solution within 1 hour, I need you to do this 3 times on specific days and time, so this is at most 3 hours of work in total
A problem could look like below
A sequence S= [S1, S2, ...,Sn] is said to be nicely spaced if every two adjacent elements differ by at most 5. More precisely. S is nicely spaced if Isi - si+1| <= 5 for all 1 <=i<=n-1
Example: S [2,0,-1,0,0] is nicely spaced while S= [3510, 6515,3511] is not Design a Dynamic Programming to solve the following
problem: Input: a sequence S] of integers.
Output: the length of the longest nicely spaced subsequence of S.
Example: for input S (1,0, 10, 5, 10, 3) the answer is 4, since [1,0,-5,-3] is the longest nicely spaced subsequence.
Please answer the following parts:
1. Define the entries of your table in words. E.g. T() or T(i, j) is...
2. State a recurrence for the entries of your table in
terms of smaller subproblems. Don't forget your base
3. Write pseudocode for your algorithm to solve this problem.
4. State and analyze the running time of your algorithm.
18 freelancers are bidding on average $129 for this job
Hello, I'm interested in your project. So, I have checked your description well and I can start working on your project. Contact me with all the details and requirements for your project.