Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Dynamic Programming Algorithms: Dynamic Solution Tables, Study notes of Computer Science

Dynamic programming solutions for various problems, including coin change, knapsack, chained matrix multiplication, optimal binary search tree, longest common subsequence, sequence alignment, floyd's shortest path algorithm, bitonic euclidean tsp, maximum contiguous sublist, longest increasing subsequence, making change with limited number of coins, price-collecting path, rocket assembly, and word segmentation.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-4tl
koofers-user-4tl 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Dynamic Programming Algorithms: Dynamic Solution Tables and more Study notes Computer Science in PDF only on Docsity! CS1510, Design and Analysis of Algorithms, Fall 2006 Patchrawat Uthaisombut Dynamic Programming general coin change problem Let CHvL be the minimum number of coins of denominations 4, 3, 1 needed to make change for v dollars CHvL = min 8 CHv - 4L + 1, CHv - 3L + 1, CHv - 1L + 1 < knapsack problem Let PHi, wL be the maximum profit that obtainable, with weight at most w, from items in the set 81, 2, …, i < PHi, wL = max 8 PHi - 1, wL, PHi - 1, w - wiL + pi< chained matrix multiplication Let M Hi, jL be the minimum number of multiplications needed to compute Ai Ai+1 … A j M Hi, jL = mini§k§ j-1 8 M Hi, kL + M Hk + 1, jL + pi-1 pk p j < optimal binary search tree Let CHi, jL be the cost of an optimal binary search tree containing real keys i, …, j and dummy keys i - 1, …, j CHi, jL = mini§r§ j 8 CHi, r - 1L + cHr + 1, jL + wHi, jL < longest common subsequence Let LHi, jL be the length of a longest common subsequence of x1 x2 … xi and y1 y2 … y j L Hi, jL = 9 LHi - 1, j - 1L + 1 if xi = y j max 8 LHi, j - 1L, LHi - 1, jL < if xi ∫ y j sequence alignment Let CHi, jL be the cost of an optimal alignment of x1 x2 … xi and y1 y2 … y j C Hi, jL = max 9 LHi - 1, j - 1L + axi y j LHi, j - 1L + d LHi - 1, jL + d = Floyd's shortest path algorithm Let LHi, j, kL be the length of a shortest path from i to j where the internal nodes are from the set 8 1, 2, …, k< We want LHi, j, nL for all i, j LHi, j, kL = min 8 LHi, j, k - 1L, LHi, k, k - 1L + LHk, j, k - 1L < bitonic euclidean TSP Label the vertices using positive integer from left to right For i < j, let LHi, jL be the length of a shortest bitonic spanning path for vertices in the set 81, 2, …, i< where one path ends at vertex i and the other path ends at vertex j We want min1§ j§i-1 8 LHn, jL + d j,n< LHi, jL = min 8 LHi - 1, jL + di-1,i, min1§ k§i-2 LHi - 1, kL + dk,i < maximum contiguous sublist DP-summary.nb 1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved