UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Similar documents
UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Math Fall Final Exam. Friday, 14 December Show all work for full credit. The problems are worth 6 points each.

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

CS684 Graph Algorithms

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 16 Notes. Class URL:

Essential Learning Outcomes for Algebra 2

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

Regular Languages and Finite Automata

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

IVA S STUDY GUIDE FOR THE DISCRETE FINAL EXAM - SELECTED SOLUTIONS. 1. Combinatorics

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

STUDY GUIDE FOR THE WRECKONING. 1. Combinatorics. (1) How many (positive integer) divisors does 2940 have? What about 3150?

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

MATH 363: Discrete Mathematics

VIII. NP-completeness

*Final Exam* EECS 203 Spring 2016

*Final Exam* EECS 203 Spring 2016

Honors Algebra 2 Final Exam 2002

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

2 hours THE UNIVERSITY OF MANCHESTER. 6 June :45 11:45

Lecture 23: More PSPACE-Complete, Randomized Complexity

CMPT307: Complexity Classes: P and N P Week 13-1

Design and Analysis of Algorithms May 12, 2011 Massachusetts Institute of Technology. Practice Final Exam. Problem Title Points Parts Grade Initials

CS 241 Analysis of Algorithms

Independence, Concentration, Bayes Theorem

Mathematics Masters Examination

Business Statistics. Lecture 3: Random Variables and the Normal Distribution

1. Introduction Recap

Discrete Mathematics and Probability Theory Summer 2014 James Cook Final Exam

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

NP-Completeness. Until now we have been designing algorithms for specific problems

CSE 105 THEORY OF COMPUTATION

CS/COE

Counting Strategies: Inclusion/Exclusion, Categories

Exam in Discrete Mathematics

CS481: Bioinformatics Algorithms

ECS122A Handout on NP-Completeness March 12, 2018

Topic -2. Probability. Larson & Farber, Elementary Statistics: Picturing the World, 3e 1

ACO Comprehensive Exam October 14 and 15, 2013

Complexity, P and NP

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CSE 321 Solutions to Practice Problems

NP-Complete Problems and Approximation Algorithms

Carleton University. Final Examination Fall DURATION: 2 HOURS No. of students: 223

4/17/2012. NE ( ) # of ways an event can happen NS ( ) # of events in the sample space

Carleton University. Final Examination Winter DURATION: 2 HOURS No. of students: 275

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Math 151. Rumbos Fall Solutions to Review Problems for Exam 2. Pr(X = 1) = ) = Pr(X = 2) = Pr(X = 3) = p X. (k) =

CSC Discrete Math I, Spring Discrete Probability

Machine Learning, Midterm Exam: Spring 2008 SOLUTIONS. Q Topic Max. Score Score. 1 Short answer questions 20.

Discrete Mathematics and Probability Theory Fall 2010 Tse/Wagner MT 2 Soln

More on NP and Reductions

NP and NP Completeness

Lecture 24: How to become Famous with P and NP

Design and Analysis of Algorithms

Tractable & Intractable Problems

Graduate Algorithms CS F-21 NP & Approximation Algorithms

Carleton University. Final Examination Fall DURATION: 2 HOURS No. of students: 195

Curriculum Area: Mathematics A Level - 2 year course (AQA) Year: 12. Aspire Learn Achieve

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Announcements. CompSci 102 Discrete Math for Computer Science. Chap. 3.1 Algorithms. Specifying Algorithms

Examination paper for TDT4120 Algorithms and Data Structures

Today. Statistical Learning. Coin Flip. Coin Flip. Experiment 1: Heads. Experiment 1: Heads. Which coin will I use? Which coin will I use?

Algorithms Design & Analysis. Approximation Algorithm

Math 230 Final Exam, Spring 2009

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

CSE 105 THEORY OF COMPUTATION

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

Lecture 4: NP and computational intractability

from notes written mostly by Dr. Matt Stallmann: All Rights Reserved

Randomized Algorithms

1 Basic continuous random variable problems

*Final Exam* EECS 203 Spring 2015

Midterm Exam 1 Solution

Representation. Stefano Ermon, Aditya Grover. Stanford University. Lecture 2

Design and Analysis of Algorithms

HW MATH425/525 Lecture Notes 1

CS155: Probability and Computing: Randomized Algorithms and Probabilistic Analysis

Exam 2 Solutions. x 1 x. x 4 The generating function for the problem is the fourth power of this, (1 x). 4

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Discrete Mathematics and Probability Theory Fall 2017 Ramchandran and Rao Midterm 2 Solutions

P [(E and F )] P [F ]

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

M378K In-Class Assignment #1

2007 Marywood Mathematics Contest

Data Structures in Java

P versus NP. Math 40210, Spring April 8, Math (Spring 2012) P versus NP April 8, / 9

Algorithm Design Strategies V

Carleton University. Final Examination Fall DURATION: 2 HOURS No. of students: 275

Unit 1: Sequence Models

Introductory Probability

Counting Strategies: Inclusion-Exclusion, Categories

MATH 3C: MIDTERM 1 REVIEW. 1. Counting

I. ORDER OF OPERATIONS

Transcription:

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Final Exam Review Session Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/

Notes 140608 Review Things to Know has been updated Decision trees to be added? Practice final questions see both ABK, RRR sets Review your HWs, quizzes, and MTs as well, of course! Finals week OHs: see Piazza Final exam Two handwritten (both sides) sheets of 8.5 x 11 paper allowed, no electronics 15 q s on final 10 q s common across sections (details not worked out) 110 points available, perfect = 100 OK from RRR this past Friday: Section B00 grade computed as max(final-only, normally-computed) TED scores updated except for poker chip credits If you see an error, contact David / Natalie Agenda for today ~20-25 example questions that should help keep you on the right study track for the actual 15 questions on final

Final Exam Topics (#q s) A topic at least one question 1. Counting: rearrangements, product keys, order form (3) 2. Functions and permutations: {in,sur,bi}jections, composition (1) 3. Probability and expectation (2) 4. Bayes rule, conditional probability, independence (1) 5. Recurrences: D/Q and Master Theorem; lhcc (lnhcc) (2) 6. Asymptotic complexity (working with big-o/ /, log vs. polynomial vs. exponential) (1) 7. Complexity zoo (P, NP, NP-hard, NP-complete) (1) 8. Graphs I (graph computations): MST, shortest paths (2) 9. Graphs II (graph types and properties): tree, bipartite; isomorphism, chromatic number, Eulerian, Hamiltonian (2) Comment: Topics 1, 2, 3, 4, 8 (9) can often overlap or combine! Comment: RRR likes decision tree questions

Topic 1 Example 1 How many different strings can be formed using all nine letters of the word EXCELLENT? How many different 3-letter strings can be formed from the letters of the word EXCELLENT if no letter can be repeated more times than it appears in the original word?

Topic 1 Example 2 How many different combinations of pennies, nickels, dimes and quarters can a piggy bank contain if it has 20 coins in it, including at least one quarter, at least two dimes, at least three nickels and at least four pennies?

Topic 1 Example 3 How many strings of three English letters have no consecutive letters the same? How many strings of three English letters have exactly two letters that are A s? How many strings of three English letters contain at most one vowel and at most one J?

Topic 2 Example 1 Consider the set A = {1, 2, 3, 4}. How many functions f: A A are not permutations? #functions = #permutations =

Topic 2 Example 2 (RRR F32,33,34) How many possible surjections are there from {1,2,3,4} {A,B}? How many possible injections are there from {1,2,3,4} {A,B}? How many possible injections are there from {A,B} {1,2,3,4}??

Topic 2 Example 3 (RRR F24) What is [(1,2,3,4) (1,2)(3,5)] -1? Express your answer in cycle notation.

Topic 2 Example 4 (~RRR F26) A teacher has four students who take an exam. He asks students to grade each others exams, such that each student grades exactly one exam and no student grades his/her own exam. In how many ways can this be done?

Topic 3 Example 1 If A and B are events in a probability space with Pr(A) = 1/3, Pr(B) = 1/4, and Pr((A B) c ) = 11/12, what is Pr((A B) c )?

Topic 3 Example 2 What is the expected sum of the numbers that appear when three fair six-sided dice are rolled?

Topic 3 Example 3(a) Consider a random graph G(V, E) where V has 8 vertices and for each vertex pair u,w V the edge (u,w) exists with probability p = 0.5. What is the expected number of edges in G? What is the expected number of K 4 subgraphs in G?

Topic 3 Example 3(b) Consider a random bipartite graph B(V 1, V 2, E) where V 1 has 5 vertices, V 2 has 3 vertices, and for each vertex pair u,w with u V 1, w V 2 the edge (u,w) exists with probability p = 0.2 What is the expected number of edges in G? What is the probability that G has exactly 5 edges? What is the expected number of triangles in G?

Topic 3 Example 4 Suppose that we flip a fair coin until it either comes up tails twice (not necessarily consecutively) or we have flipped it four times. What is the expected number of times we flip the coin?

Topic 4 Example 1(a) A Discrete Joint Probability (Pete s discussion slide) X\Y X=0 X=1 X=2 Sum Y=0.05.1.15.3 Y=1.15.05.15.35 Y=2.2.05.1.35 Sum.4.2.4 1 What is Pr(Y = 1)? What is Pr( Y = 2 X = 0 )?

Given: Pr(Y = 2 X = 0) =.5 Pr(Y = 2) =.35 Pr(X = 0) =.4 Topic 4 Example 1(b) What is P(X = 0 Y = 2)? Express as a fraction in lowest terms.

Topic 4 Example 2 Suppose that a Bayesian spam filter is trained on a set of 10000 spam messages and 5000 messages that are not spam. The word herbal appears in 800 spam messages and 200 messages that are not spam. 50% of the incoming email messages to the inbox are spam. Find an expression for the probability that a received message containing the word herbal is spam.

Topic 4 Example 3(a) What is the conditional probability that when a fair coin is flipped four times, at least two consecutive heads will come up, given that the first flip came up tails?

Topic 4 Example 3(b) Let E be the event that when a fair coin is flipped four times, exactly one head comes up. Let F be the event that when a fair coin is flipped four times, the first flip is heads. Are E and F independent? Justify. RRR F36: Let P(A) = 0.3, P(A B) = 0.7, and P(B c ) = 0.6. Are A and B independent events?

Topic 5 Example 1 Define the recurrence a n = 6a n-1 8a n-2 for n 2, with a 0 = 0 and a 1 = 2. Find an explicit closed-form solution for a n. Which of the following big-o classes is a n in? (a) O(n) (b) O(n 2 ) (c) O(2 n ) (d) O(4 n ) (e) None of above.

Topic 5 Example 2 Give the general solution to the recurrence x(n+2) = 6x(n+1) 9x(n), n 0, with x(0) = 0, x(1) = 1.

Topic 5 Example 3 Suppose that a divide-and-conquer algorithm s runtime on instances of size n is governed by the recurrence T(n) = 8T(n/2) + O(n 2 ). Apply the Master Theorem and give the resulting big-o expression for T(n). Suppose that a divide-and-conquer algorithm s runtime on instances of size n is governed by the recurrence T(n) = 7T(n/2) + O(n 2 ). Apply the Master Theorem and give the resulting big-o expression for T(n).

Topic 5 Example 4 Give the closed-form solution to T(n) = T(n-1) + 3, where T(0) = 1. Give the closed-form solution to T(n) = T(n-1) + 2n, where T(0) = 1.

Topic 6 Example 1 You are given that f O(r) and g O(s). Justify the claim that f+g is O(r+s). You are given that f O(g) and g O(h). Justify the claim that f O(h). Let f(x) = 1000x 2, g(x) = 10x 3. Justify the claim that f O(g).

Topic 7 Example 1 The Isomorphism(G,H) decision problem is: Given two graphs G and H, does there exist an isomorphism between G and H? Explain why Isomorphism(G,H) is in the class NP **IF** it were known that Isomorphism(G,H) was an NP-hard problem, would Isomorphism(G,H) be NP-complete?

Topic 7 Example 2 The EC(G) decision problem is: Given a graph G, does G contain an Euler circuit? Explain why EC(G) is in the class P **IF** it were known that EC(G) was an NP-hard problem, would EC(G) be NP-complete?

Topics 8/9 Example 1(a) Consider the following pair of graphs. Are these graphs isomorphic? Explain.

Topics 8/9 Example 1(b) Consider the following pair of graphs. For each graph: (i) is the graph Eulerian? (ii) does the graph contain an Eulerian trail? (iii) is the graph Hamiltonian?

Topics 8/9 Example 2(a) Consider the following graph with positive edge weights. What are the first three edges found by Kruskal s MST algorithm?

Topics 8/9 Example 2(b) Consider the following graph with positive edge weights. What are the first four edges found by Prim s MST algorithm starting at the vertex v 0? What are the first four edges found by Prim s MST algorithm starting at the vertex v 5?

Topics 8/9 Example 2(c) Consider the following graph with positive edge weights. Give, in order, the first four vertices from which the search parties will call home in Dijkstra s shortest-paths algorithm, if the algorithm starts from vertex v 0.

Succinct Certificates If I claim to have a solution, can I prove its correctness to you in polynomial time? How do I prove that a number is composite? Can you check my proof easily? How do I prove that there is a Hamiltonian cycle in a given graph? Can you check my proof easily? How do I prove that there is a TSP tour of cost in a given graph? Can you check my proof easily? How do I prove that a given graph can be colored using at most 5 colors? Can you check my proof easily?

The Classes P and NP Classes of Decision Problems P: Problems for which there exists a deterministic polynomial-time algorithm NP: Problems for which there exists a nondeterministic polynomial-time algorithm non-deterministic polynomial-time Solutions are small (== polynomial-size) Guessing is free Solutions must be checkable in polynomial time (== succinct certificate ) P NP (why??) but whether P = NP is not known Most people believe P NP, which would imply P NP

NP-Hard, NP-Complete NP-Hard: Problem X is NP-hard if every problem in NP is polynomially reducible to X Solving any problem in NP can be boiled down to solving X X is at least as hard as any problem in NP NP-Complete: Problem X is NP-complete if: X is NP-hard, and X is in NP The hardest problems in NP