Who knows dynamic programming in c ?

This is a discussion on Who knows dynamic programming in c ? within the C Programming forums, part of the General Programming Boards category; Hi, ı have some problem with my dynamic programming assignment. I can do it by using c. But ı don't ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    2

    Who knows dynamic programming in c ?

    Hi, ı have some problem with my dynamic programming assignment. I can do it by using c. But ı don't know how to use dynamic programming.
    In the assignment we are asking to find the maximum sequence in a list (such as longest common subsequence)

    we have to write an application to decide which group to pick to get the maximum number of subsequence. If we take from one number we can not take from its immediate neighbors.The input will be an array with maximum 40 elements.However we have to do it with dynamic programming.

    Example:

    insert
    Code:
    Input: {4,12} Returns: 12 
    Input: {10,12,1} Returns: 12 
    Input: {1,1,4,4,6,1,1,3,4,6} Returns: 20  1,4,6,3 and 6 are picked.
    Please help me

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    It has nothing to do with the language. You can do dynamic programming in any language where you can remember things (that's all "dynamic programming" means).

    We won't do your assignment for you, though.

    Show us what you've got first.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    2
    I wrote it as pseudo code, but not with dynamic programming

    sum(A,n): for all n

    if n=0, max = 0 else
    if n=1, max=A[1] else
    max = sum(A[n] + sum(A,n-2), sum(A,n-1))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 12-23-2009, 01:55 PM
  2. Replies: 4
    Last Post: 11-02-2006, 11:41 AM
  3. Identify dynamic IP address of network device
    By BobS0327 in forum Tech Board
    Replies: 2
    Last Post: 02-21-2006, 01:49 PM
  4. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-07-2003, 12:51 AM
  5. Dynamic Toolbars
    By nvoigt in forum Windows Programming
    Replies: 1
    Last Post: 01-11-2002, 10:21 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21