Download presentation
Presentation is loading. Please wait.
1
Dynamic Programming 1 Neil Tang 4/15/2008
CS223 Advanced Data Structures and Algorithms
2
CS223 Advanced Data Structures and Algorithms
Class Overview Basic Idea Fibonacci numbers Recursive equation evaluation All-pairs shortest paths CS223 Advanced Data Structures and Algorithms
3
CS223 Advanced Data Structures and Algorithms
Basic Idea Mathematically express the problem in the recursive form. Solve it by a non-recursive algorithm that systematically records the answers to the subproblems in a table. CS223 Advanced Data Structures and Algorithms
4
CS223 Advanced Data Structures and Algorithms
Fibonacci Numbers fib(N) = fib(N-1) + fib(N-2) CS223 Advanced Data Structures and Algorithms
5
CS223 Advanced Data Structures and Algorithms
Fibonacci Numbers CS223 Advanced Data Structures and Algorithms
6
CS223 Advanced Data Structures and Algorithms
Fibonacci Numbers A dynamic programming based algorithm CS223 Advanced Data Structures and Algorithms
7
Recursive Equation Evaluation
CS223 Advanced Data Structures and Algorithms
8
Recursive Equation Evaluation
CS223 Advanced Data Structures and Algorithms
9
Recursive Equation Evaluation
A dynamic programming based algorithm CS223 Advanced Data Structures and Algorithms
10
All-pairs Shortest Path
The all-pairs shortest path problem: Given a weighted graph G, find the shortest (minimum cost) path between every pair of nodes in G. CS223 Advanced Data Structures and Algorithms
11
All-Pairs Shortest Path
Recursive expression for node pair (i, j) Dk,i,j = min{Dk-1,i,j, Dk-1,i,k+Dk-1,k,j} CS223 Advanced Data Structures and Algorithms
12
All-Pairs Shortest Path
Time Complexity: O(|V|3) CS223 Advanced Data Structures and Algorithms
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.