Note06

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Outline 1 Greedy Algorithms Elements of Greedy Algorithms Greedy Choice Property for Kruskal's Algorithm 0/1 Knapsack Problem Activity Selection Problem Scheduling All Intervals 2 3 4 5 6 c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 1 / 49 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 49 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 49 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These solutions are called feasible solutions. (In general, there are many feasible solutions.) c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 49 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These solutions are called feasible solutions. (In general, there are many feasible solutions.) We have an optimization measure defined for each feasible solution. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 49 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These solutions are called feasible solutions. (In general, there are many feasible solutions.) We have an optimization measure defined for each feasible solution. We are looking for a feasible solution that optimizes (either maximum or minimum) the optimization measure. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. Goal: Minimize the the total number of scalar multiplications. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. Goal: Minimize the the total number of scalar multiplications. 0/1 Knapsack Problem A feasible solution is any subset of items whose total weight is at most the knapsack capacity K. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. Goal: Minimize the the total number of scalar multiplications. 0/1 Knapsack Problem A feasible solution is any subset of items whose total weight is at most the knapsack capacity K. The optimization measure is the total item profit of the subset. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. Goal: Minimize the the total number of scalar multiplications. 0/1 Knapsack Problem A feasible solution is any subset of items whose total weight is at most the knapsack capacity K. The optimization measure is the total item profit of the subset. Goal: Maximize the the total profit. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 49 Greedy Algorithms General Description Given an optimization problem P, we seek an optimal solution. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 4 / 49 Greedy Algorithms General Description Given an optimization problem P, we seek an optimal solution. The solution is obtained by a sequence of steps. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 4 / 49 Greedy Algorithms General Description Given an optimization problem P, we seek an optimal solution. The solution is obtained by a sequence of steps. In each step, we select...
View Full Document

This note was uploaded on 02/27/2012 for the course CSE 431/531 taught by Professor Xinhe during the Fall '11 term at SUNY Buffalo.

Ask a homework question - tutors are online