general_suggestion

general_suggestion - 4 When you are writing the recurrence...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
General suggestions to solve dynamic programming (DP) problem: 1. Modify the known solution to solve your new problem. For example, we can make use the solution of 0-1 knapsack problem to solve the minimum number of coins problem. (Example: Question 2b in tutorial 8) 2. Usually, we can write down your global optimal (goal) solution first. Then, try to generalize it into a general form, which cover all possible cases. For example, in our matrix chain multipication problem, we write the goal optimal as M [1 ,N ], then generalize it to M [ i,j ]. (Example: Question 2a/b in tutorial 8) 3. Derive the boundary conditions (Example: Question 2a/b in tutorial 8 OR lecture sketches)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4. When you are writing the recurrence, you may find it is difficult to fill it some parameters. Recall that you are often able to consider all possible cases on some parameters by brute force. (Example: Question 2a in tutorial 8) 5. Doing the running time analysis is simple. In general, you just need to consider how many time is spent on each entry. Then you count how many entries you have been filled. Multiplying them together gives you the total running time. (Example: Question 2a in tutorial 8) c ± 2006 Chung Kai Lun Peter. Comments are welcomed. Email: [email protected] 1...
View Full Document

This note was uploaded on 12/09/2010 for the course ENGLISH 1303 taught by Professor May during the Spring '10 term at HKU.

Ask a homework question - tutors are online