COMP 251 Study Guide - Final Guide: Optimal Substructure, Dynamic Programming, Quicksort

106 views2 pages

Document Summary

This is a collection of problems that you can use to prepare the comp 251 nal exam. This selection of problems covers the second part of the class (i. e. after the mid-term exam). However, the nal exam will also cover the material of the. Please, refer to the practice problems for the mid-term, and solution of the midterm (last lecture) to fully prepare the exam. Dynamic programming: the coin row problem: suppose you have a row of coins with values that are positive integers c1, , cn. Your task is to pick up coins have as much total value as possible, subject to the constraint that you don"t ever pick up two coins that lie beside each other. You may use as many of each type of coin as you wish. As an example, suppose the coin values c1, c2, and c3 are 1, 3, 4.