Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j

Size: px
Start display at page:

Download "Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j"

Transcription

1 Practice Final Solutions 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) 2 j = 0 3 if (n = 0) 4 return j } 5 else 6 j = 2n+ alg(n 1) 7 return j } } Set up a recurrence relation (with initial conditions) whose solution gives L(n), the number of lines executed when alg(n) runs. (You do not need to solve this recurrence relation.) Also set one up for R(n), the return value for alg(n). Solution: Let L(n) be the number of lines executed when alg(n) runs. If n > 0, then we will execute lines 1, 2, 3, 5, and 6. Next we will call alg(n 1), which will execute L(n 1) lines. Last, we will execute line 7. This gives a total of 6+L(n 1) lines. If, on the other hand, n = 0, then we will execute only lines 1, 2, 3, and 4. Therefore, the recurrence relation with initial conditions is L(n) = 6 + L(n 1) n > 0. L(0) = 4 For the return value, if n > 0, the algorithm returns the value in j, which is 2n plus whatever alg(n 1) returns. If n = 0 then the algorithm also returns j, but this time j = 0. Therefore the recurrence relation with initial conditions is 2. Consider the set X = 1, 2}. R(n) = 2n + R(n 1) n > 0. R(0) = 0 (a) List all relations on this set. Which are reflexive? Transitive? Symmetric? Equivalence relations? Solution: A relation is a subset of the set X X. Therefore we need to know what the elements of X X look like. They are the following: 1

2 X X = (1, 1), (1, 2), (2, 1), (2, 2)}. Since this set has four elements, it should have 2 4 = 16 subsets. Therefore there are 16 relations on the set X. These relations are size sets 0 } 1 (1, 1)}, (1, 2)}, (2, 1)}, (2, 2)} 2 (1, 1), (1, 2)}, (1, 1), (2, 1)}, (1, 1), (2, 2)}, (1, 2), (2, 1)} (1, 2), (2, 2)}, (2, 1), (2, 2)} 3 (1, 1), (1, 2), (2, 1)}, (1, 1), (1, 2), (2, 2)}, (1, 1), (1, 2), (2, 2)}, (1, 2), (2, 1), (2, 2)} 4 (1, 1), (1, 2), (2, 1), (2, 2)} The reflexive relations are (1, 1), (2, 2)}, (1, 1), (2, 2), (1, 2)}, (1, 1), (2, 2), (2, 1)}, The transitive relations are (1, 1), (1, 2), (2, 1), (2, 2)}. }, (1, 1)}, (1, 2)}, (2, 1)}, (2, 2)} (1, 1), (2, 2)}, (1, 1), (2, 1)}, (1, 2), (2, 2)}, (2, 1), (2, 2)}, (1, 1), (1, 2), (2, 2)}, (1, 1), (2, 1), (2, 2)}, The symmetric relations are (1, 1), (1, 2), (2, 1), (2, 2)}. }, (1, 1)}, (2, 2)}, (1, 1), (2, 2)}, (1, 2), (2, 1)}, (1, 1), (1, 2), (2, 1)}, (1, 2), (2, 1), (2, 2)}, (1, 1), (1, 2), (2, 1), (2, 2)}. Therefore, the equivalence relations are (1, 1), (2, 2)}, (1, 1), (1, 2), (2, 1), (2, 2)}. (b) How many of those relations are functions? One to one functions? Onto functions? Invertible functions? Solution: A function is a relation R which has the property that for each x X there is a unique y X such that (x, y) R. Therefore, the functions are (1, 1), (2, 2)}, (1, 2), (2, 2)}, (1, 1), (2, 1)}, (1, 2), (2, 1)}. The one to one functions are 2

3 (1, 1), (2, 2)}, (1, 2), (2, 1)}. These are also the onto functions, and the invertible functions. (c) List all partitions of X. Solution: Recall that a partition P of X is a set of subsets of X such that i. for each S, T P such that S T, we have S T = }, and ii. the union of all elements of P is the set X. The above definition allows to include the empty set in a partition. I will let you choose whether or not you want to. Here, we will not. Therefore, the partitions of X are 1}, 2}}, 1, 2}}. 3. Out of 30 students, 10 do not have American citizenship and 20 do not have Canadian citizenship. There are 5 students with both American and Canadian citizenship. How many have neither Canadian nor American citizenship? Solution: You should draw a Venn diagram for this problem (and follow along with my explanation). Let A be the set of students who have American citizenship and let C be the set of students who have Canadian citizenship. Let S be the set of all students. We know that the number of elements of S \ A (which we denote by S \ A ) is 10 and that S \ C = 20. This means that In addition, we are told that A = 20 and C = 10. Since we get A C = 5. A C = A + C A C, A C = = 25. This is the number of students with American or Canadian citizenship. Therefore the number of students without either citizenship is 5. 3

4 4. (a) Solve the following recurrence relation, writing the term L(n) as a function of n. L(n) = 3L(n 1) + 10L(n 2) L(1) = 2 L(2) = 3 Solution: FIrst we consider the characteristic equation of the recurrence: This gives roots Therefore the general solution is r 2 3r 10 = 0, or (r 5)(r + 2) = 0. r 1 = 2, r 2 = 5. L(n) = c 1 ( 2) n + c 2 (5) n. To solve for the constants, use the initial conditions. 2 = L(1) = c 1 ( 2) 1 + c 2 (5) 1 3 = L(2) = c 1 ( 2) 2 + c 2 (5) 2 2 = 2c 1 + 5c 2 3 = 4c c 2 Multiply the first equation by 2 to get 4 = 4c c 2 3 = 4c c 2 and add the two equations to get 7 = 35c 2, so that c 2 = 1/5. Plug this into the original first equation to get Therefore, the specific solution is 2 = 2c 1 + (1/5)(5) 2 = 2c c 1 = 1/2. L(n) = ( 1/2)( 2) n + (1/5)(5) n = ( 2) n n 1. 4

5 (b) Suppose that your answer L(n) above is the number of lines executed for an algorithm that you wrote. Suppose that I have another algorithm which does the same as your algorithm but has a run-time complexity of θ(n 4 ). Which algorithm is better? Prove your answer is correct. Solution: The algorithm with complexity θ(n 4 ) is better. The reason is that it has a lower complexity than the given algorithm, which has run-time complexity θ(5 n ). We can see this as follows: L(n) = ( 2) n n 1 5 n n 1 = (1/5)(5) n + (1/5)(5) n = (2/5)5 n, so that L(n) = O(5 n ). To show the other direction, notice that for n 2, so that 2 n 1 (5/2) n 1 (1/2)(5) n 1 (1/2)5 n, L(n) = ( 2) n n 1 5 n 1 2 n 1 5 n 1 (1/2)5 n 1 = (1/2)5 n 1 = (1/10)5 n. This gives L(n) = Ω(5 n ). Therefore, L(n) = θ(5 n ), which is incredibly greater than θ(n 4 ). 5. (a) Does the graph below have an Euler cycle? Why or why not? Solution: Yes it does. The reason is that the degree of each vertex is even, and we know that this is equivalent to having an Euler cycle. 5

6 (b) Solve the traveling salesman problem for the graph below. After that, list the order in which edges are added into a minimal spanning tree using Kruskal s algorithm. Next do the same, but for Prim s algorithm, starting at the lower left vertex. Solution: To solve the traveling salesman problem, we note that there are 5 vertices, so any Hamiltonian cycle must have 5 edges. So we will list combinations of 5 edges, in order of increasing total weight, until we find a Hamiltonian cycle. We will list the edges by their weights since they are all distinct. edge combination Hamiltonian cycle? no no no yes So a solution is the Hamiltonian cycle consisting of edges labeled 1, 2, 4, 5, and 6. The total weight of this solution is 18. Note that this argument does not rule out the existence of other solutions. For Kruskal s algorithm, we add edges into a growing tree, in order of increasing weight, making sure to omit edges which form cycles in our tree. Therefore we will add edges 1, 2, 3, 4 (in order of our addition). Note we stop at 4 edges because there are 5 vertices in the graph, and consequently any spanning tree will have 4 edges. For Prim s algorithm, we invade from the start vertex at the lower left. The edges we will add (in order) are 1, 2, 3, 4. 6

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60 McGill University Faculty of Science Solutions to Practice Final Examination Math 40 Discrete Structures Time: hours Marked out of 60 Question. [6] Prove that the statement (p q) (q r) (p r) is a contradiction

More information

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization Problem set 8: solutions 1. Fix constants a R and b > 1. For n N, let f(n) = n a and g(n) = b n. Prove that f(n) = o ( g(n) ). Solution. First we observe that g(n) 0 for all

More information

MATH 363: Discrete Mathematics

MATH 363: Discrete Mathematics MATH 363: Discrete Mathematics Learning Objectives by topic The levels of learning for this class are classified as follows. 1. Basic Knowledge: To recall and memorize - Assess by direct questions. The

More information

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 Do all problems. Put your answers on blank paper or in a test booklet. There are 00 points total in the exam. You have 80 minutes. Please note

More information

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

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

More information

MATH 243E Test #3 Solutions

MATH 243E Test #3 Solutions MATH 4E Test # Solutions () Find a recurrence relation for the number of bit strings of length n that contain a pair of consecutive 0s. You do not need to solve this recurrence relation. (Hint: Consider

More information

and e 2 ~ e 2 iff e 1

and e 2 ~ e 2 iff e 1 Section 4. Equivalence Relations A binary relation is an equivalence relation if it has the three properties reflexive, symmetric, and transitive (RST). Examples. a. Equality on any set. b. x ~ y iff x

More information

(1) Which of the following are propositions? If it is a proposition, determine its truth value: A propositional function, but not a proposition.

(1) Which of the following are propositions? If it is a proposition, determine its truth value: A propositional function, but not a proposition. Math 231 Exam Practice Problem Solutions WARNING: This is not a sample test. Problems on the exams may or may not be similar to these problems. These problems are just intended to focus your study of the

More information

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Radhika Nagpal Quiz 1 Appendix Appendix Contents 1 Induction 2 2 Relations

More information

5. Partitions and Relations Ch.22 of PJE.

5. Partitions and Relations Ch.22 of PJE. 5. Partitions and Relations Ch. of PJE. We now generalize the ideas of congruence classes of Z to classes of any set X. The properties of congruence classes that we start with here are that they are disjoint

More information

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion CHAPTER 1 Relations 1. Relations and Their Properties 1.1. Definition of a Relation. Definition 1.1.1. A binary relation from a set A to a set B is a subset R A B. If (a, b) R we say a is Related to b

More information

(c) Give a proof of or a counterexample to the following statement: (3n 2)= n(3n 1) 2

(c) Give a proof of or a counterexample to the following statement: (3n 2)= n(3n 1) 2 Question 1 (a) Suppose A is the set of distinct letters in the word elephant, B is the set of distinct letters in the word sycophant, C is the set of distinct letters in the word fantastic, and D is the

More information

Exam Practice Problems

Exam Practice Problems Math 231 Exam Practice Problems WARNING: This is not a sample test. Problems on the exams may or may not be similar to these problems. These problems are just intended to focus your study of the topics.

More information

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

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm Outline 1 NP-Completeness Theory 2 Limitation of Computation 3 Examples 4 Decision Problems 5 Verification Algorithm 6 Non-Deterministic Algorithm 7 NP-Complete Problems c Hu Ding (Michigan State University)

More information

Spanning Trees in Grid Graphs

Spanning Trees in Grid Graphs Spanning Trees in Grid Graphs Paul Raff arxiv:0809.2551v1 [math.co] 15 Sep 2008 July 25, 2008 Abstract A general method is obtained for finding recurrences involving the number of spanning trees of grid

More information

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018 Relations Alice E. Fischer April, 2018 1 Inverse of a Relation 2 Properties of Relations The Inverse of a Relation Let R be a relation from A to B. Define the inverse relation, R 1 from B to A as follows.

More information

Name: Student ID: Instructions:

Name: Student ID: Instructions: Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student

More information

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

2 hours THE UNIVERSITY OF MANCHESTER. 6 June :45 11:45 2 hours THE UNIVERSITY OF MANCHESTER DISCRETE MATHEMATICS 6 June 2016 9:45 11:45 Answer ALL THREE questions in Section A (30 marks in total) and TWO of the THREE questions in Section B (50 marks in total).

More information

RELATIONS AND FUNCTIONS

RELATIONS AND FUNCTIONS For more important questions visit : www.4ono.com CHAPTER 1 RELATIONS AND FUNCTIONS IMPORTANT POINTS TO REMEMBER Relation R from a set A to a set B is subset of A B. A B = {(a, b) : a A, b B}. If n(a)

More information

Problem 2: (Section 2.1 Exercise 10) (a.) How many elements are in the power set of the power set of the empty set?

Problem 2: (Section 2.1 Exercise 10) (a.) How many elements are in the power set of the power set of the empty set? Assignment 4 Solutions Problem1: (Section 2.1 Exercise 9) (a.) List all the subsets of the set {a, b, c, d} which contain: (i.) four elements (ii.) three elements (iii.) two elements (iv.) one element

More information

Exam in Discrete Mathematics

Exam in Discrete Mathematics Exam in Discrete Mathematics First Year at the Faculty of Engineering and Science and the Technical Faculty of IT and Design June 4th, 018, 9.00-1.00 This exam consists of 11 numbered pages with 14 problems.

More information

Minimum spanning tree

Minimum spanning tree Minimum spanning tree Jean Cousty MorphoGraph and Imagery 2011 J. Cousty : MorphoGraph and Imagery 1/17 Outline of the lecture 1 Minimum spanning tree 2 Cut theorem for MST 3 Kruskal algorithm J. Cousty

More information

Reexam in Discrete Mathematics

Reexam in Discrete Mathematics Reexam in Discrete Mathematics First Year at the Faculty of Engineering and Science and the Technical Faculty of IT and Design August 15th, 2017, 9.00-13.00 This exam consists of 11 numbered pages with

More information

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

CSC 8301 Design & Analysis of Algorithms: Lower Bounds CSC 8301 Design & Analysis of Algorithms: Lower Bounds Professor Henry Carter Fall 2016 Recap Iterative improvement algorithms take a feasible solution and iteratively improve it until optimized Simplex

More information

Name: Block: Unit 2 Inequalities

Name: Block: Unit 2 Inequalities Name: Block: Unit 2 Inequalities 2.1 Graphing and Writing Inequalities 2.2 Solving by Adding and Subtracting 2.3 Solving by Multiplying and Dividing 2.4 Solving Two Step and Multi Step Inequalities 2.5

More information

HOMEWORK #2 - MATH 3260

HOMEWORK #2 - MATH 3260 HOMEWORK # - MATH 36 ASSIGNED: JANUARAY 3, 3 DUE: FEBRUARY 1, AT :3PM 1) a) Give by listing the sequence of vertices 4 Hamiltonian cycles in K 9 no two of which have an edge in common. Solution: Here is

More information

Math Homework 5 Solutions

Math Homework 5 Solutions Math 45 - Homework 5 Solutions. Exercise.3., textbook. The stochastic matrix for the gambler problem has the following form, where the states are ordered as (,, 4, 6, 8, ): P = The corresponding diagram

More information

Polynomial-time reductions. We have seen several reductions:

Polynomial-time reductions. We have seen several reductions: Polynomial-time reductions We have seen several reductions: Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in

More information

1. (12 points) Give a table-driven parse table for the following grammar: 1) X ax 2) X P 3) P DT 4) T P 5) T ε 7) D 1

1. (12 points) Give a table-driven parse table for the following grammar: 1) X ax 2) X P 3) P DT 4) T P 5) T ε 7) D 1 1. (12 points) Give a table-driven parse table for the following grammar: 1) X ax 2) X P 3) P DT 4) T P 5) T ε 6) D 0 7) D 1 4. Recall that our class database has the following schemas: SNAP(StudentID,

More information

ABHELSINKI UNIVERSITY OF TECHNOLOGY

ABHELSINKI UNIVERSITY OF TECHNOLOGY Approximation Algorithms Seminar 1 Set Cover, Steiner Tree and TSP Siert Wieringa siert.wieringa@tkk.fi Approximation Algorithms Seminar 1 1/27 Contents Approximation algorithms for: Set Cover Steiner

More information

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

More information

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) The final exam will be on Thursday, May 12, from 8:00 10:00 am, at our regular class location (CSI 2117). It will be closed-book and closed-notes, except

More information

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Section Summary. Relations and Functions Properties of Relations. Combining Relations Chapter 9 Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations Closures of Relations (not currently included

More information

More on NP and Reductions

More on NP and Reductions Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

Graph Theory and Optimization Computational Complexity (in brief)

Graph Theory and Optimization Computational Complexity (in brief) Graph Theory and Optimization Computational Complexity (in brief) Nicolas Nisse Inria, France Univ. Nice Sophia Antipolis, CNRS, I3S, UMR 7271, Sophia Antipolis, France September 2015 N. Nisse Graph Theory

More information

CS/MATH 111 Winter 2013 Final Test

CS/MATH 111 Winter 2013 Final Test CS/MATH 111 Winter 2013 Final Test The test is 2 hours and 30 minutes long, starting at 7PM and ending at 9:30PM There are 8 problems on the test. Each problem is worth 10 points. Write legibly. What can

More information

Mathematics for Computer Science MATH 1206C [P.T.O] Page 1 of 5

Mathematics for Computer Science MATH 1206C [P.T.O] Page 1 of 5 x Page 1 of 5 Question 1: (25 Marks) ANSWER ALL QUESTIONS (a) Prove by mathematical induction that for n 1, n r=1 (b) State and prove the Well-Ordering Principle. r 3 = n2 4 (n + 1)2. (c) Using proof by

More information

k 6, then which of the following statements can you assume to be

k 6, then which of the following statements can you assume to be MA-UY2314 Discrete Mathematics Quiz 9 Name: NYU Net ID: 1.1) Suppose that in a proof by strong induction, the following statement is the inductive hypothesis: For k 6, P(j) is true for any j in the range

More information

1. How many labeled trees are there on n vertices such that all odd numbered vertices are leaves?

1. How many labeled trees are there on n vertices such that all odd numbered vertices are leaves? 1. How many labeled trees are there on n vertices such that all odd numbered vertices are leaves? This is most easily done by Prüfer codes. The number of times a vertex appears is the degree of the vertex.

More information

Algorithm Design Strategies V

Algorithm Design Strategies V Algorithm Design Strategies V Joaquim Madeira Version 0.0 October 2016 U. Aveiro, October 2016 1 Overview The 0-1 Knapsack Problem Revisited The Fractional Knapsack Problem Greedy Algorithms Example Coin

More information

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2007

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2007 University of New Mexico Department of Computer Science Final Examination CS 362 Data Structures and Algorithms Spring, 2007 Name: Email: Print your name and email, neatly in the space provided above;

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

Discrete Mathematics Fall 2018 Midterm Exam Prof. Callahan. Section: NetID: Multiple Choice Question (30 questions in total, 4 points each)

Discrete Mathematics Fall 2018 Midterm Exam Prof. Callahan. Section: NetID: Multiple Choice Question (30 questions in total, 4 points each) Discrete Mathematics Fall 2018 Midterm Exam Prof. Callahan Section: NetID: Name: Multiple Choice Question (30 questions in total, 4 points each) 1 Consider the following propositions: f: The student got

More information

Bounds on the Traveling Salesman Problem

Bounds on the Traveling Salesman Problem Bounds on the Traveling Salesman Problem Sean Zachary Roberson Texas A&M University MATH 613, Graph Theory A common routing problem is as follows: given a collection of stops (for example, towns, stations,

More information

1 Chapter 1: SETS. 1.1 Describing a set

1 Chapter 1: SETS. 1.1 Describing a set 1 Chapter 1: SETS set is a collection of objects The objects of the set are called elements or members Use capital letters :, B, C, S, X, Y to denote the sets Use lower case letters to denote the elements:

More information

CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, CS1800 Discrete Structures Final

CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, CS1800 Discrete Structures Final CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, 2017 CS1800 Discrete Structures Final Instructions: 1. The exam is closed book and closed notes. You may not use a calculator or any

More information

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement Tutorial - 1 1. Obtain the principal disjunctive normal form and principal conjunction form of the statement Let S P P Q Q R P P Q Q R A: P Q Q R P Q R P Q Q R Q Q R A S Minterm Maxterm T T T F F T T T

More information

R(p, k) = the near regular complete k-partite graph of order p. Let p = sk+r, where s and r are positive integers such that 0 r < k.

R(p, k) = the near regular complete k-partite graph of order p. Let p = sk+r, where s and r are positive integers such that 0 r < k. MATH3301 EXTREMAL GRAPH THEORY Definition: A near regular complete multipartite graph is a complete multipartite graph with orders of its partite sets differing by at most 1. R(p, k) = the near regular

More information

MODERN APPLIED ALGEBRA

MODERN APPLIED ALGEBRA Paper IV (Elective -) - Curriculum ACHARYA NAGARJUNA UNIVERSITY CURRICULUM - B.A / B.Sc MATHEMATICS - PAPER - IV (ELECTIVE - ) MODERN APPLIED ALGEBRA 90 hrs (3hrs / week) UNIT - (30 Hours). SETS AND FUNCTIONS

More information

Data Structures and Algorithms (CSCI 340)

Data Structures and Algorithms (CSCI 340) University of Wisconsin Parkside Fall Semester 2008 Department of Computer Science Prof. Dr. F. Seutter Data Structures and Algorithms (CSCI 340) Homework Assignments The numbering of the problems refers

More information

Math 564 Homework 1. Solutions.

Math 564 Homework 1. Solutions. Math 564 Homework 1. Solutions. Problem 1. Prove Proposition 0.2.2. A guide to this problem: start with the open set S = (a, b), for example. First assume that a >, and show that the number a has the properties

More information

Worksheet on Relations

Worksheet on Relations Worksheet on Relations Recall the properties that relations can have: Definition. Let R be a relation on the set A. R is reflexive if for all a A we have ara. R is irreflexive or antireflexive if for all

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Session 21. April 13, 2009 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3137 Announcements Homework 5 due next Monday I m out of town Wed to Sun for conference

More information

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013 University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter 2013 Exam Solution, Monday, March 18, 2013 Instructions: NAME: Closed book, closed notes, no calculators

More information

Sets, Functions and Relations

Sets, Functions and Relations Chapter 2 Sets, Functions and Relations A set is any collection of distinct objects. Here is some notation for some special sets of numbers: Z denotes the set of integers (whole numbers), that is, Z =

More information

Greedy Algorithms My T. UF

Greedy Algorithms My T. UF Introduction to Algorithms Greedy Algorithms @ UF Overview A greedy algorithm always makes the choice that looks best at the moment Make a locally optimal choice in hope of getting a globally optimal solution

More information

Discrete Mathematics, Spring 2004 Homework 9 Sample Solutions

Discrete Mathematics, Spring 2004 Homework 9 Sample Solutions Discrete Mathematics, Spring 00 Homework 9 Sample Solutions. #3. A vertex v in a tree T is a center for T if the eccentricity of v is minimal; that is, if the maximum length of a simple path starting from

More information

CSE 591 Foundations of Algorithms Homework 4 Sample Solution Outlines. Problem 1

CSE 591 Foundations of Algorithms Homework 4 Sample Solution Outlines. Problem 1 CSE 591 Foundations of Algorithms Homework 4 Sample Solution Outlines Problem 1 (a) Consider the situation in the figure, every edge has the same weight and V = n = 2k + 2. Easy to check, every simple

More information

Relations Graphical View

Relations Graphical View Introduction Relations Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Recall that a relation between elements of two sets is a subset of their Cartesian

More information

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

More information

Mathematical Thinking Exam 2 20 November 2017

Mathematical Thinking Exam 2 20 November 2017 Mathematical Thinking Exam 2 20 November 2017 Name: Instructions: Be sure to read each problem s directions. Write clearly during the exam and fully erase or mark out anything you do not want graded. You

More information

STANDARDS OF LEARNING CONTENT REVIEW NOTES. ALGEBRA I Part I. 2 nd Nine Weeks,

STANDARDS OF LEARNING CONTENT REVIEW NOTES. ALGEBRA I Part I. 2 nd Nine Weeks, STANDARDS OF LEARNING CONTENT REVIEW NOTES ALGEBRA I Part I 2 nd Nine Weeks, 2016-2017 OVERVIEW Algebra I Content Review Notes are designed by the High School Mathematics Steering Committee as a resource

More information

Subspaces and Spanning Sets

Subspaces and Spanning Sets Subspaces and Spanning Sets 9 It is time to study vector spaces more carefully and return to some fundamental questions: 1. Subspaces: When is a subset of a vector space itself a vector space? (This is

More information

Planar Graphs (1) Planar Graphs (3) Planar Graphs (2) Planar Graphs (4)

Planar Graphs (1) Planar Graphs (3) Planar Graphs (2) Planar Graphs (4) S-72.2420/T-79.5203 Planarity; Edges and Cycles 1 Planar Graphs (1) Topological graph theory, broadly conceived, is the study of graph layouts. Contemporary applications include circuit layouts on silicon

More information

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2013

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2013 University of New Mexico Department of Computer Science Final Examination CS 561 Data Structures and Algorithms Fall, 2013 Name: Email: This exam lasts 2 hours. It is closed book and closed notes wing

More information

MGF 1106: Exam 1 Solutions

MGF 1106: Exam 1 Solutions MGF 1106: Exam 1 Solutions 1. (15 points total) True or false? Explain your answer. a) A A B Solution: Drawn as a Venn diagram, the statement says: This is TRUE. The union of A with any set necessarily

More information

Question Paper Code :

Question Paper Code : www.vidyarthiplus.com Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011. Time : Three hours Fourth Semester Computer Science and Engineering CS 2251 DESIGN AND ANALYSIS OF ALGORITHMS (Regulation

More information

Wed Feb The vector spaces 2, 3, n. Announcements: Warm-up Exercise:

Wed Feb The vector spaces 2, 3, n. Announcements: Warm-up Exercise: Wed Feb 2 4-42 The vector spaces 2, 3, n Announcements: Warm-up Exercise: 4-42 The vector space m and its subspaces; concepts related to "linear combinations of vectors" Geometric interpretation of vectors

More information

1-1. Expressions and Formulas. Lesson 1-1. What You ll Learn. Active Vocabulary

1-1. Expressions and Formulas. Lesson 1-1. What You ll Learn. Active Vocabulary 1-1 Expressions and Formulas What You ll Learn Skim the lesson. Write two things you already know about expressions and formulas. 1. Active Vocabulary 2. Review Vocabulary Identify the four grouping symbols

More information

(a) We need to prove that is reflexive, symmetric and transitive. 2b + a = 3a + 3b (2a + b) = 3a + 3b 3k = 3(a + b k)

(a) We need to prove that is reflexive, symmetric and transitive. 2b + a = 3a + 3b (2a + b) = 3a + 3b 3k = 3(a + b k) MATH 111 Optional Exam 3 lutions 1. (0 pts) We define a relation on Z as follows: a b if a + b is divisible by 3. (a) (1 pts) Prove that is an equivalence relation. (b) (8 pts) Determine all equivalence

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

X-MA2C01-1: Partial Worked Solutions

X-MA2C01-1: Partial Worked Solutions X-MAC01-1: Partial Worked Solutions David R. Wilkins May 013 1. (a) Let A, B and C be sets. Prove that (A \ (B C)) (B \ C) = (A B) \ C. [Venn Diagrams, by themselves without an accompanying logical argument,

More information

The number of Euler tours of random directed graphs

The number of Euler tours of random directed graphs The number of Euler tours of random directed graphs Páidí Creed School of Mathematical Sciences Queen Mary, University of London United Kingdom P.Creed@qmul.ac.uk Mary Cryan School of Informatics University

More information

You may hold onto this portion of the test and work on it some more after you have completed the no calculator portion of the test.

You may hold onto this portion of the test and work on it some more after you have completed the no calculator portion of the test. MTH 5 Winter Term 010 Test 1- Calculator Portion Name You may hold onto this portion of the test and work on it some more after you have completed the no calculator portion of the test. 1. Consider the

More information

CSI 4105 MIDTERM SOLUTION

CSI 4105 MIDTERM SOLUTION University of Ottawa CSI 4105 MIDTERM SOLUTION Instructor: Lucia Moura Feb 6, 2010 10:00 am Duration: 1:50 hs Closed book Last name: First name: Student number: There are 4 questions and 100 marks total.

More information

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

CMPSCI 311: Introduction to Algorithms Second Midterm Exam CMPSCI 311: Introduction to Algorithms Second Midterm Exam April 11, 2018. Name: ID: Instructions: Answer the questions directly on the exam pages. Show all your work for each question. Providing more

More information

AC64/AT64/ AC115/AT115 DESIGN & ANALYSIS OF ALGORITHMS

AC64/AT64/ AC115/AT115 DESIGN & ANALYSIS OF ALGORITHMS Q.2 a. Solve the recurrence relation: T (n)=2t(n/2) + n; T(1) = 0 (6) Refer Complexity analysis of merge soft. b. Write the psuedocode for the Selection sort algorithm. What loop variant does it maintain?

More information

USA Mathematical Talent Search Round 2 Solutions Year 27 Academic Year

USA Mathematical Talent Search Round 2 Solutions Year 27 Academic Year 1/2/27. In the grid to the right, the shortest path through unit squares between the pair of 2 s has length 2. Fill in some of the unit squares in the grid so that (i) exactly half of the squares in each

More information

Homework 1 Submission

Homework 1 Submission Homework Submission Sample Solution; Due Date: Thursday, May 4, :59 pm Directions: Your solutions should be typed and submitted as a single pdf on Gradescope by the due date. L A TEX is preferred but not

More information

Divide-and-conquer: Order Statistics. Curs: Fall 2017

Divide-and-conquer: Order Statistics. Curs: Fall 2017 Divide-and-conquer: Order Statistics Curs: Fall 2017 The divide-and-conquer strategy. 1. Break the problem into smaller subproblems, 2. recursively solve each problem, 3. appropriately combine their answers.

More information

Intro to Contemporary Math

Intro to Contemporary Math Intro to Contemporary Math Hamiltonian Circuits and Nearest Neighbor Algorithm Nicholas Nguyen nicholas.nguyen@uky.edu Department of Mathematics UK Agenda Hamiltonian Circuits and the Traveling Salesman

More information

Methods for solving recurrences

Methods for solving recurrences Methods for solving recurrences Analyzing the complexity of mergesort The merge function Consider the following implementation: 1 int merge ( int v1, int n1, int v, int n ) { 3 int r = malloc ( ( n1+n

More information

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B. Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination III (Spring 2007) Problem 1: Suppose A, B, C and D are finite sets

More information

Parameterized Domination in Circle Graphs

Parameterized Domination in Circle Graphs Parameterized Domination in Circle Graphs Nicolas Bousquet 1, Daniel Gonçalves 1, George B. Mertzios 2, Christophe Paul 1, Ignasi Sau 1, and Stéphan Thomassé 3 1 AlGCo project-team, CNRS, LIRMM, Montpellier,

More information

CS325: Analysis of Algorithms, Fall Final Exam

CS325: Analysis of Algorithms, Fall Final Exam CS: Analysis of Algorithms, Fall 0 Final Exam I don t know policy: you may write I don t know and nothing else to answer a question and receive percent of the total points for that problem whereas a completely

More information

MATH 433 Applied Algebra Lecture 14: Functions. Relations.

MATH 433 Applied Algebra Lecture 14: Functions. Relations. MATH 433 Applied Algebra Lecture 14: Functions. Relations. Cartesian product Definition. The Cartesian product X Y of two sets X and Y is the set of all ordered pairs (x,y) such that x X and y Y. The Cartesian

More information

Counting and Constructing Minimal Spanning Trees. Perrin Wright. Department of Mathematics. Florida State University. Tallahassee, FL

Counting and Constructing Minimal Spanning Trees. Perrin Wright. Department of Mathematics. Florida State University. Tallahassee, FL Counting and Constructing Minimal Spanning Trees Perrin Wright Department of Mathematics Florida State University Tallahassee, FL 32306-3027 Abstract. We revisit the minimal spanning tree problem in order

More information

Selected Solutions to Even Problems, Part 3

Selected Solutions to Even Problems, Part 3 Selected Solutions to Even Problems, Part 3 March 14, 005 Page 77 6. If one selects 101 integers from among {1,,..., 00}, then at least two of these numbers must be consecutive, and therefore coprime (which

More information

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic).

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic). Trees A tree is a graph which is (a) Connected and (b) has no cycles (acyclic). 1 Lemma 1 Let the components of G be C 1, C 2,..., C r, Suppose e = (u, v) / E, u C i, v C j. (a) i = j ω(g + e) = ω(g).

More information

PRELIMINARIES FOR GENERAL TOPOLOGY. Contents

PRELIMINARIES FOR GENERAL TOPOLOGY. Contents PRELIMINARIES FOR GENERAL TOPOLOGY DAVID G.L. WANG Contents 1. Sets 2 2. Operations on sets 3 3. Maps 5 4. Countability of sets 7 5. Others a mathematician knows 8 6. Remarks 9 Date: April 26, 2018. 2

More information

Decomposing planar cubic graphs

Decomposing planar cubic graphs Decomposing planar cubic graphs Arthur Hoffmann-Ostenhof Tomáš Kaiser Kenta Ozeki Abstract The 3-Decomposition Conjecture states that every connected cubic graph can be decomposed into a spanning tree,

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

MA554 Assessment 1 Cosets and Lagrange s theorem

MA554 Assessment 1 Cosets and Lagrange s theorem MA554 Assessment 1 Cosets and Lagrange s theorem These are notes on cosets and Lagrange s theorem; they go over some material from the lectures again, and they have some new material it is all examinable,

More information

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG Suggested Problems for Sets and Functions The following problems are from Discrete Mathematics and Its Applications by Kenneth H. Rosen. 1. Define the

More information

Contents Lecture 4. Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression

Contents Lecture 4. Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression Contents Lecture 4 Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression Jonas Skeppstedt (jonasskeppstedt.net) Lecture 4 2018

More information

Introduction to Divide and Conquer

Introduction to Divide and Conquer Introduction to Divide and Conquer Sorting with O(n log n) comparisons and integer multiplication faster than O(n 2 ) Periklis A. Papakonstantinou York University Consider a problem that admits a straightforward

More information

What you learned in Math 28. Rosa C. Orellana

What you learned in Math 28. Rosa C. Orellana What you learned in Math 28 Rosa C. Orellana Chapter 1 - Basic Counting Techniques Sum Principle If we have a partition of a finite set S, then the size of S is the sum of the sizes of the blocks of the

More information

Linear Algebra MATH20F Midterm 1

Linear Algebra MATH20F Midterm 1 University of California San Diego NAME TA: Linear Algebra Wednesday, October st, 9 :am - :5am No aids are allowed Be sure to write all row operations used Remember that you can often check your answers

More information