CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 3
Five Representative Problems Show the types of problems we will be considering in the class Similar looking problems with very different characteristics Problems –Scheduling –Weighted Scheduling –Bipartite Matching –Maximum Independent Set –Competitive Facility Location
Interval Scheduling Input: Set of jobs with start and finish times Goal: Find maximum cardinality subset of mutually compatible jobs Time f g h e a b c d h e b jobs don't overlap
Interval Scheduling n log n greedy algorithm
Suppose We Add Values?
Weighted Interval Scheduling Input: Set of jobs with start, finish, and weights Goal: Find maximum weight subset of mutually compatible jobs Time n log n dynamic programming algorithm
Bipartite Matching Input: Bipartite graph –A graph G = (V, E) is bipartite if V can be partitioned into sets X and Y such that every edge in E has one end in X and the other end in Y Goal: Find maximum cardinality matching –A matching is M E with property that each node in V appears in at most one edge of M C A E 3 B D4 professors courses can teach
Bipartite Matching C A E 3 B D4
Find a Maximum Matching n k max-flow based algorithm
Independent Set Input: Graph Goal: Find maximum cardinality independent set subset of nodes such that no two joined by an edge
Find a Maximum Independent Set NP-complete No efficient algorithm is known, and it is conjectured that no such algorithm exists
Key characteristics Hard to find a solution Easy to verify a solution once you have one Other problems like this –Hamiltonian circuit –Clique –Subset sum –Graph coloring
NP-Completeness Theory of Hard Problems A large number of problems are known to be equivalent Very elegant theory
Are There Even Harder Problems? Simple game: –Players alternating selecting nodes in a graph Score points associated with node Remove node’s neighbors –When neither can move, player with most points wins
Competitive Facility Location For a particular player P i, is there a strategy so that, no matter how the other players play, P i will be able to select a set of nodes with a total value of at least X? Hard to convince someone of the answer to this question (i.e., no short proof, lengthy case-by-case analysis), compare with Independent Set Problem PSPACE-complete