Chengwei LEI, Ph.D.    Associate Professor

Department of Computer and Electrical Engineering and Computer Science
California State University, Bakersfield

CMPS 3120 Algorithm Analysis

 

Dynamic Programming

 


The change-making problem addresses the question of finding the minimum number of coins (of certain denominations) that add up to a given amount of money.

Given unlimited amounts of coins of denominations d1 > … > dm , give change for amount n with the least number of coins.

Abnormal coin change problem:

Solution

 


My personal "magic spell" for Dynamic Programming:

Who am I? Where did I come from? Where am I going?


 Row of coins picking problem: There is a row of n coins whose values are some positive integers c1,c2,...,cn, not necessarily distinct. The goal is to pick up the maximum amount of money subject to the constraint that no two coins adjacent in the initial row can be picked up.

 

Solution




 Robot Collect Coin problem: Several coins are placed in cells of an n×m board. A robot, located in the upper left cell of the board, needs to collect as many of the coins as possible and bring them to the bottom right cell. On each step, the robot can move either one cell to the right or one cell down from its current location.