Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Discussion On Dynamic Programming
Rating 4 V
rajibbd
post Jul 31 2007, 07:25 PM
Post #1


Newbie [Level 3]
***

Group: Members
Posts: 47
Joined: 22-July 07
From: Dhaka, Bangladesh
Member No.: 46,859



Dynamic Programming[DP] is one of the powerful programming approach now a day. DP applicable when sub problems share sub sub problems. (No independent sub problems). Solve each sub problem once, save the answer, and when needed use the previously computed result. Like for Fibonacci series. To get f(n+1) we need addition of f(n), f(n-1) and for f(n) we need f(n-1), f(n-2). so to get f(n+1) we need f(n) and f(n-1) and again for f(n) we need f(n-1) and f(n-2). In this approach we are calculating same thing more then once[as we need sub problem and for sub problem we need sub sub problem]. That is a very bad idea. But what if we store the data of f(n), f(n-1), f(n-1),..f(2), f(1), f(0) and reuse it while needed. That is one of the DP approach. DP is typically applied to optimization problem. Many solutions but DP find the one with minimum/maximum value. DP finds an optimal solution, rather the optimal solution.
Four steps of DP
  • Characterize the structure of the optimal solution.
  • Recursively define the value of the optimal solution.
  • Compute the value of the optimal solution in a bottom-up fashion.
  • Construct the optimal solution from computer result.
Go to the top of the page
 
+Quote Post
osknockout
post Aug 3 2007, 03:47 AM
Post #2


Super Member
*********

Group: Members
Posts: 396
Joined: 14-November 04
From: Elysium
Member No.: 2,280



QUOTE
DP finds an optimal solution, rather the optimal solution.
Alright. What on earth are you trying to say?
Anyway, isn't it common programming practice to do what you're suggesting anyway? I mean really, who actually spends time
looping through a function recursively until he gets an answer instead of simply writing some code to go from (n-1) to n?

Oh, and there's a name for your little technique. It's called lookup tables. Look it up.

This post has been edited by osknockout: Aug 3 2007, 03:49 AM
Go to the top of the page
 
+Quote Post
rajibbd
post Aug 3 2007, 08:56 AM
Post #3


Newbie [Level 3]
***

Group: Members
Posts: 47
Joined: 22-July 07
From: Dhaka, Bangladesh
Member No.: 46,859



[cont] A problem may have many solution but we are trying to find out an optimal solution. I believe to learn a better programing language need to learn bettere technique. Dynamic Programing is use for optimize the solution. Each problem have many solution with various valus but we are trying to find out the optimal solution by using this DP approach. There are many problem who is solved under this approach. But obviously not every problem. Now you may woundering where we should apply those two method. If the problem is "Optimal Substure" and overlapping subproblems. Only then this dynamic programming can be applicable. If you need to know much about it then you better read book.
Go to the top of the page
 
+Quote Post
laexter
post Nov 4 2007, 04:45 PM
Post #4


Newbie [Level 1]
*

Group: Members
Posts: 18
Joined: 3-November 07
From: Jakarta, Indonesia
Member No.: 52,426



QUOTE
Oh, and there's a name for your little technique. It's called lookup tables. Look it up.


Actually lookup tables officially has the name "memoisation", which is one form of dynamic programming (the top-down approach). The bottom up approach is sometimes faster and sometimes slower (in bottom-up approach, you generate all the answers to all subproblems then use that for answering the real thing). Dynamic programming will be very useful in very specific problems, namely when they have overlapping subproblems (like said).

IMHO if you are interested in algorithms then proficiency in dynamic programming (and whether you know about it) is one of the "benchmark" of your programming skill.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. A Question About C++ Programming Under Linux(7)
  2. Grand Theft Auto: San Andreas(40)
  3. What Is A T_string?(13)
  4. Java Script Drop Down Menu With Css(2)
  5. General Discussion: Artificial Intelligence (AI)(33)
  6. What Is Neuro Linguistic Programming(19)
  7. Good Books On C++ Game Programming(2)
  8. What Programming Languages Should I Choose?(17)
  9. Css And Javascript Combined For Dynamic Layout(9)
  10. How Can I Learn Assembly(14)
  11. Life In Programming?(9)
  12. Free Tutorial (web Programming) + Free Web Hosting(10)
  13. What Is Programming Language Of Google Etc.?(21)
  14. Muslims Not Allowed To Date(8)
  15. How Many of You Use the C Programming language?(23)
  1. Programming In Glut (lesson 6)(2)
  2. Can I Make Dynamic Menu In Php(7)
  3. I'm Looking For Help With Programming (i Think)(3)
  4. Ratchet And Clank Future(1)
  5. Are Some Christians Pushing For A New Crusade?(7)
  6. Independent Kosovo(2)
  7. Python(8)
  8. Trap17 Dynamic Recent Post/topic Image(17)
  9. Help On Choosing Forum Discussion Category(5)
  10. Free Newsgroups (based On Nntp Protocol)(0)
  11. Learn Java Programming Language Online Step By Step(0)
  12. What Is Genetic Programming?(2)
  13. A Prelude To Programming(9)


 



- Lo-Fi Version Time is now: 25th July 2008 - 09:43 AM