1 / 21

Algorithms and Data Review Fall 2010

Algorithms and Data Review Fall 2010. Karl Lieberherr. Problem Solving. Polya: How to Solve It. Algorithmic Patterns. Greedy Divide and Conquer Dynamic Programming Network Flow Intractability: Reductions and characterization of NP. Algorithmic thinking. Making claims about algorithms

maili
Download Presentation

Algorithms and Data Review Fall 2010

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms and Data ReviewFall 2010 Karl Lieberherr CS 4800 Fall 2010

  2. Problem Solving • Polya: How to Solve It CS 4800 Fall 2010

  3. Algorithmic Patterns • Greedy • Divide and Conquer • Dynamic Programming • Network Flow • Intractability: Reductions and characterization of NP CS 4800 Fall 2010

  4. Algorithmic thinking • Making claims about algorithms • Choosing from a predefined set of claims • claims that are refuted • claims that are defended • Used: Scientific Community Game for Algorithmic domains • make learning interactive and second order • students who are better at the game are better at algorithms CS 4800 Fall 2010

  5. Summary of SCG Definitions Domain Problem Solution valid(Problem, Solution) quality(Problem, Solution) →[0,1] Claim(Domain) Problems: PowerSet(Domain.Problem) q: Quality = [0,1] r: Resource = N+ Rules of the Scientific Community: propose and oppose, be an active scholar, rules for reputation accumulation. Tournaments CS 4800 Fall 2010

  6. Formal: HSR • Domain: • Problem: (n,k), k <= n. • Solution: Decision tree to determine highest safe rung. • quality(problem, solution): depth of decision tree / number of rungs • valid(problem, solution): at most k left branches, ... CS 4800 Fall 2010

  7. Formal: HSR • Claim(Domain): • Alice claims ({(25,2)},9/25,5 seconds) • {(25,2)}: set of problems (singleton) • 9/25: quality • 5 seconds: resource • Refutation Protocol: • Bob refutes: only one problem: (25,2) • Alice: solves problem by providing decision tree t. • predicate: t is a valid decision tree for (25,2) of depth 9 CS 4800 Fall 2010

  8. Protocol variationsExample: Independent Set • Domain • Problem: Directed graph G=(V,E) • Solution: V’ subset of V • Claim • Problems: all directed graphs with < 10^6 nodes • quality: |V’|/|V| • Protocol • Alice to Admin: G, AlgA(G) • Admin to Bob: G • Bob to Admin: AlgB(G) • Admin to both: AlgB(G), r[G,AlgB(G),AlgA(G)] Alice claims that her algorithm finds a solution at least as good as Bob’s. CS 4800 Fall 2010

  9. Protocol variationsExample: Knapsack • Domain • Problem: Knapsack problem K(n,Items(Weights,Values),W) • Solution: subset of Items • Claim • Problems: all knapsack problems with W < 10^3 • quality: |V’|/|V| • Protocol • Alice to Admin: K, AlgA(K) • Admin to Bob: K • Bob to Admin: AlgB(K) including AlgB(K).resource • Admin to both: AlgB(K) including AlgB(K).resource, r[K,AlgB(K),AlgA(K)] Alice claims that her algorithm finds a solution at least as good as Bob’s and using fewer resources. CS 4800 Fall 2010

  10. Languages for expressing algorithms • Decision trees • Finite state machines • Pseudo code • Programming languages CS 4800 Fall 2010

  11. Prove properties about algorithm • Find an invariant of the algorithm that helps to prove what you want. • Example: Ford-Fulkerson • Dynamic Programming: formulate recurrence for optimal solution in terms of optimal solutions for sub problems. • Formulate algorithm so that it is easier to prove its correctness. CS 4800 Fall 2010

  12. Intractability • Problems that don’t have an algorithmic solution. E.g. is grammar ambiguous? • Problems that don’t have an efficient algorithmic solution, e.g., NP-complete problems. • Reduction: Y <= X : Y is reducible to X, Y reduces to X: an algorithm for X implies an algorithm for Y • Polynomial Reduction: Y <=p X: a polynomial algorithm for X implies a polynomial algorithm for Y. CS 4800 Fall 2010

  13. NP-complete Problem X • X in NP • for all Y in NP, Y <=p X. Every problem in NP can be reduced to X. Circuit Satisfiability is NP-complete. CS 4800 Fall 2010

  14. More NP-complete problems • If Y is NP-complete and X is in NP with the property that Y <=p X, then X is NP-complete. CS 4800 Fall 2010

  15. Strategy for proving problem X to be NP-complete • Prove that X in NP. • Choose a problem Y that is NP-complete. • Prove that Y <=p X. • Cook and Karp (translation) reductions (page 473) • Example of Cook reduction: search (FSAT) reduces to decision (SAT) CS 4800 Fall 2010

  16. Interview question • Given a set S and a predicate pred defined on subsets of S, find a subset ss of S satisfying pred. • Example pred: false on all subsets not having 3 elements. For 3 element subsets pred({a,b,c}) iff a+b+c=0. CS 4800 Fall 2010

  17. Order Statistics • Given a sequence of n numbers, find the kth largest element. • O(n*log(n)) • O(n*log(k)) • O(n): median of the median CS 4800 Fall 2010

  18. Expected number of satisfied constraints under random assignment • Maximum Satisfiability • Maximum Boolean CSP CS 4800 Fall 2010

  19. Problem Snapshot • Boolean CSP: constraint satisfaction problem • Each constraint uses a Boolean relation. • e.g. a Boolean relation 1in3(x y z) is satisfied iff exactly one of its parameters is true. • Boolean MAX-CSPa multi-set of constraints. Maximize satisfied fraction. CS 4800 Fall 2010

  20. 3p(1-p)2 for MAX-CSP({22}) CS 4800 Fall 2010

  21. all the look-ahead polynomials for T Ball CS 4800 Fall 2010

More Related