CSCI 2300 Lab 8 Fall 2014, 10/29/14

This lab is about Dynamic Programming - Please read Chapter 6 of DG's book.
  1. 6.1 (DG) - Design an algorithm to solve this problem. Implement that algorithm, (Hint: You may want to have variables runningsum and bestmax. If runningsum > bestmax then replace bestmax by running sum. if running sum is < 0 then you may want to reset runningsum to zero. Increase the index of the array). Also output the contiguous subsequence) use the data from the book for testing.
  2. Write a program to compute the length of longest nondecreasing subsequence in a given array of integers. The following is the way we formulated to compute the length at position j. use the data
    If Array indices start from 0.
    Initialization: len[0]=1;len[j]=1 for all j
    Computation: to calculate len[j]
    for (i=0;i<j;i++)
     if (a[i] ≤ a[j])
      if (len[j] < len[i]+1)
        len[j]=len[i]+1
    
  3. Do problem 6.3 (DG) Your job is to write the formulation for Dynamic Porgramming in terms of the following equations - given m[i], profit[i], write the equation for finding max_expected profit if one places a Yuckdonald in ith location and write a program to solve it. Data consists of number of locations, then the list of miles followed by the corresponding lists of profits followed by k the minimum length that any two restuarants should be at least k miles apart - (k in this data is 6) You may use the data for your program.