This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 310 Exam 3 Review Furman Haddix Ph.D. Assistant Professor Minnesota State University, Mankato Spring 2008 Dynamic Programming Objectives What is Dynamic Programming Fibonacci algorithm topdown, bottom up, memoized Factory Example Matrix Multiplication Example Memoization Example Text, Chapter 15.115.3 Dynamic Programming Dynamic programming is a methodology rather than an algorithm Like Divide and Conquer, dynamic programming is a means of solving problems efficiently and effective Dynamic Programming is generally concerned with optimization problems Dynamic Programming applications have two characteristics: Overlapping subproblems: subproblem a is used in solving both subproblem b and subproblem c. A recursive solution will contain many instances of the same subproblem. The (optimal) solution contains (optimal) solutions to a subset of subproblems BEWARE the fallacy of suboptimization: Not all problems can be decomposed into subproblems for which optimal subproblem solutions are parts of the optimal problem solution Where applicable, dynamic programming may provide a more efficient solution than divide and conquer An Approach to Dynamic Programming 1. Characterize the structure of an optimal solution (Return the n th Fibonacci number) 2. Recursively define the value of an optimal solution (Recursive definition of Fibonacci series) 3. Compute the value of an optimal solution in bottomup fashion (Convert topdown solution to bottomup solution) 4. Construct an optimal solution from computed information (Solution of subproblems is solution to problem) Although Fibonacci problem is not seeking an optimal solution it has many of the characteristics of the class of problem for which dynamic programming provides good solutions. Factory Production Line Example Factory has two production lines composed of multiple stations Each station performs the same function Production lines were established at different times with different technologies Over time, some stations have been replaced For each station, the faster production method may be on a different line Because of different technologies employed, production times differ at each station I n general, transfer times between stations of the same line are insignificant; however, transfer times between stations of different lines are not insignificant. Also, the entry times and exit times are different for the two production lines because of their physical locations. Factory Production Line Example Mathematically, we can represent the production time on a line i, as follows: P i = E i + S ij + X i where E refers to entry time, S is station time, X is exit time, and j is one of n stations On occasion, it may be important to have a production run that is the fastest possible....
View Full
Document
 Spring '08
 FurmanHaddix
 C Programming

Click to edit the document details