Mathematics Masters Examination

Similar documents
Mathematics Masters Examination

CS 373: Combinatorial Algorithms, Spring 1999

The National Strategies Secondary Mathematics exemplification: Y8, 9

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

Module Four: Connecting Algebra and Geometry Through Coordinates

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

CS 373: Combinatorial Algorithms, Fall Name: Net ID: Alias: U 3 / 4 1

Discrete mathematics , Fall Instructor: prof. János Pach

END-TERM EXAMINATION

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

BMO Round 1 Problem 6 Solutions

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

2. CONNECTIVITY Connectivity

CS 532: 3D Computer Vision 14 th Set of Notes

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

Analysis of Algorithms

Prelim 2. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer

Properties of Quadratic functions

CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008

6th Bay Area Mathematical Olympiad

Discrete Mathematics I So Practice Sheet Solutions 1

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

Part II. Graph Theory. Year

Assignment 1 Introduction to Graph Theory CO342

The Geometry of Carpentry and Joinery

Naming Angles. One complete rotation measures 360º. Half a rotation would then measure 180º. A quarter rotation would measure 90º.

IMO Training 2010 Double Counting Victoria Krakovna. Double Counting. Victoria Krakovna

CMSC 380. Graph Terminology and Representation

Questions Total Points Score

r=1 The Binomial Theorem. 4 MA095/98G Revision

Unit 2A: Angle Pairs and Transversal Notes

Computational Geometry

Math 485, Graph Theory: Homework #3

Polygon decomposition. Motivation: Art gallery problem

Lecture 3: Art Gallery Problems and Polygon Triangulation

Angles of Polygons. Essential Question What is the sum of the measures of the interior angles of a polygon?

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2012

Straight-line Drawability of Embedded Graphs

The Probabilistic Method

Line Arrangement. Chapter 6

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

CS 2336 Discrete Mathematics

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Signature: Question # Out Of Marks Marker Total

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

Interactive Math Glossary Terms and Definitions

Math 414 Lecture 2 Everyone have a laptop?

Graph Theory Questions from Past Papers

Theorem 2.9: nearest addition algorithm

Lesson 19: The Graph of a Linear Equation in Two Variables is a Line

CS-6402 DESIGN AND ANALYSIS OF ALGORITHMS

15-451/651: Design & Analysis of Algorithms October 11, 2018 Lecture #13: Linear Programming I last changed: October 9, 2018

Exercise set 2 Solutions

The Art Gallery Problem: An Overview and Extension to Chromatic Coloring and Mobile Guards

Geometry Unit 6 Properties of Quadrilaterals Classifying Polygons Review

Connected Components of Underlying Graphs of Halving Lines

Coverage and Search Algorithms. Chapter 10

Real life Problem. Review

Convex Geometry arising in Optimization

Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA === Homework submission instructions ===

Indicate the option which most accurately completes the sentence.

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

Basic Properties The Definition of Catalan Numbers

Prelim 2 Solutions. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer

8.NS.1 8.NS.2. 8.EE.7.a 8.EE.4 8.EE.5 8.EE.6

GEOMETRY. TI-Nspire Help and Hints. 1 Open a Graphs and Geometry page. (Press c 2 ).

Solutions to Midterm 2 - Monday, July 11th, 2009

7. The Gauss-Bonnet theorem

Chislehurst and Sidcup Grammar School Mathematics Department Year 9 Programme of Study

MISCELLANEOUS SHAPES

The Algorithm Design Manual

Computational Discrete Mathematics

Professor: Padraic Bartlett. Lecture 9: Trees and Art Galleries. Week 10 UCSB 2015

Math 443/543 Graph Theory Notes 5: Planar graphs and coloring

Vertex-Colouring Edge-Weightings

Unit 1, Lesson 1: Moving in the Plane

Introduction to Geometry

Graph Algorithms Using Depth First Search

CSCE 310 Assignment 3 Summer 2018

6.854J / J Advanced Algorithms Fall 2008

4. Simplicial Complexes and Simplicial Homology

Student number: Datenstrukturen & Algorithmen page 1

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

Middle School Math Course 3

Student number: Datenstrukturen & Algorithmen page 1

Texas High School Geometry

Total Score /1 /20 /41 /15 /23 Grader

Correlation of the ALEKS courses Algebra 1 and High School Geometry to the Wyoming Mathematics Content Standards for Grade 11

Lesson Plan #39. 2) Students will be able to find the sum of the measures of the exterior angles of a triangle.

XVIII. AMC 8 Practice Questions

Answers to specimen paper questions. Most of the answers below go into rather more detail than is really needed. Please let me know of any mistakes.

Vertex Cover Approximations

UNIVERSITY OF MANITOBA. SIGNATURE: (in ink) (I understand that cheating is a serious offense)

Central Valley School District Math Curriculum Map Grade 8. August - September

Improved Bounds for Intersecting Triangles and Halving Planes

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

Ma/CS 6b Class 26: Art Galleries and Politicians

Lecture 22 Tuesday, April 10

Transcription:

Mathematics Masters Examination OPTION 4 March 30, 2004 COMPUTER SCIENCE 2 5 PM NOTE: Any student whose answers require clarification may be required to submit to an oral examination. Each of the fourteen numbered questions is worth 20 points. All questions will be graded, but your score for the examination will be the sum of your scores on your eight best questions. Please observe the following: DO NOT answer two or more questions on the same sheet (not even on both sides of the same sheet). DO NOT write your name on any of your answer sheets. You will be given separate instructions on the use of these answer sheets. When you have completed a question, place it in the large envelope provided. Spring 04 CS 1/4

1. Computer Algorithms Given an array A of n elements, we wish to find the k largest in sorted order using the following 3 algorithms. Find their (worst-case) running-times in terms of n and k. (a) MergeSort A and list k largest. (b) Build a max-heap and call EXTRACT-MAX k times. 2. 3. 4. 5. 6. (c) SELECT the k largest number, partition around that number and sort the k largest numbers. Let G =(V,E) be a directed graph with V = n and E = m. Suppose that each vertex u V is labelled with a unique integer L(u) from the set {1, 2,...,n}. For each u V, let R(u) ={v V : u v} be the set of the vertices that can be reached by a directed path starting from u. Define min(u) to be the vertex in R(u) whole label is minimum. Give an O(n + m)-time algorithm that computes min(u) for all vertices u V. Programming Language Design C++ uses pointers to elements of type (say) E as a common alternative to indexes when accessing elements of arrays. Give at least one reason in favor of this scheme and one reason against it (observe that the scheme has been abandoned in Java). C++ (at least most versions) does not guard against a pointer going out of bounds of an array it is indexing. Why not? Could such a check be put into the language as a modification? What would be the cost of doing so? Combinatorics Consider a rectangular box with distinct dimensions. Color the 12 edges B, W, or R. Find the number of inequivalent colorings with 4B, 4W, and 4R edges. Colorings are equivalent with respect to rotations of the box. (Note that since the dimensions are distinct, the rotation must use an angle of 180 degrees and the axis must join the middle of opposite faces.) Find the number of permutations of 1, 2,...,6 in which 1 and 2 are in positions 3,4,5,6; 3 and 4 are in positions 1,2,5,6; and 5 and 6 are in positions 1,2,3,4. Graph Theory All graphs are simple and undirected. Let H be a subgraph of K n,n with more than (k 1)n edges. Prove that H has a matching of size k. Spring 04 CS 2/4

7. Theory of Computation Let Σ = {0, 1}. Construct a DFA for the following language: L = {w w does not contain the substring 00, and w is even}. 8. Explain and justify your construction. Notes: w is the length of w, and substring means a sequence of consecutive symbols. Let Σ = {0, 1, #}. Construct a CF grammar generating the following language: L = {w # x#w R w, x {0, 1} }. 9. 10. Explain and justify your construction. Symbolic Computation Explain the difference between Int and int in Maple. Give an example to illustrate why we need a command like Int. Numerical Analysis Consider the matrix A = with inverse A 1 = 1.5906E +00 1.1367E 01 8.8133E 01 3.8693E 01 2.7644E 02 2.1440E 01 1.0159E +00 7.2596E 02 5.6290E 01 3.8816E +09 4.5674E +09 7.8171E +09 1.5738E +08 1.8505E +08 3.1690E +08 6.9849E +09 8.2190E +09 1.4067E +10. 1. Estimate the condition number of A using. 1 (the maximum column sum) as norm. 2. For this given matrix A, we now consider the linear system Ax = b, for any general right-hand side vector b, and we forget about the inverse A 1. What is the relation between the relative error on the solution x to Ax = b and the relative error on A? Use cond(a) in your answer. If we want to know the first eight decimal places of x, how accurately must we know A? Justify your answer. Spring 04 CS 3/4

11. Suppose we want to approximate the first derivative f (x 0 ) of some function f(x) at the point x 0. 1. Show that the forward-difference approximation using step h>0 is only a first-order approximation in h for f (x 0 ). 2. Develop extrapolation formulas to compute a third-order approximation in h for f (x 0 ), cutting the step h in half each time. 12. 13. Computational Geometry A Star-shaped polygon (SSP) is a simple polygon all of whose interior is visible from at least one point in the polygon s interior. We shall call such a point a point of total visibility (PTV). It is clear that a star-shaped polygon need not be convex. The Kernel of a SSP is a region of its interior containing all of its PTV s. Observe that if the SSP happens to be convex, its kernel will span the entire interior of the SSP. Outline a proof sketch that the kernel of a SSP is a convex polygon inside the SSP. (Hint: Start with a 4-sided polygon with vertex angles 3 of which are convex, turning to the right in a clockwise traversal of the polygon (just like a convex polygon) and 1 of which is reflex (turning to the left). Draw the kernel of this polygon. Now consider how the kernel is constrained when there are several reflex angles. For instance, draw the kernel when there are two reflex angles.) Error-Correcting Codes and Cryptography A binary code C is described by its parity-check matrix H = 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1. (a) How would you encode the messages m 1 = 0000 and m 2 = 1101? (b) How would you decode the received vectors v 1 = 0000111 and v 2 = 0001110? (c) Find the parameters n, k, and d for C. 14. In a public-key cryptosystem using RSA, you intercept the cryptogram C = 10 sent to a receiver whose public key is e = 5 and n = 35. Find the integer M that was sent. Spring 04 CS 4/4

Solutions to the Mathematics Masters Examination OPTION 4 March 30, 2004 COMPUTER SCIENCE 2 5 PM NOTE: Any student whose answers require clarification may be required to submit to an oral examination. Each of the fourteen numbered questions is worth 20 points. All questions will be graded, but your score for the examination will be the sum of your scores on your eight best questions. Please observe the following: DO NOT answer two or more questions on the same sheet (not even on both sides of the same sheet). DO NOT write your name on any of your answer sheets. You will be given separate instructions on the use of these answer sheets. When you have completed a question, place it in the large envelope provided. Spring 04 CS 1/9

1. Computer Algorithms Given an array A of n elements, we wish to find the k largest in sorted order using the following 3 algorithms. Find their (worst-case) running-times in terms of n and k. (a) MergeSort A and list k largest. (b) Build a max-heap and call EXTRACT-MAX k times. (c) SELECT the k largest number, partition around that number and sort the k largest numbers. Solution: (a) Sorting costs n log n and listing costs k. Total O(n log n). (b) Building a max-heap cost n and extracting k times costs k log n. Total O(n + k log n). (c) Selecting and partitioning costs n and sorting costs k log k. Total is O(n + k log k). 2. Let G =(V,E) be a directed graph with V = n and E = m. Suppose that each vertex u V is labelled with a unique integer L(u) from the set {1, 2,...,n}. For each u V, let R(u) ={v V : u v} be the set of the vertices that can be reached by a directed path starting from u. Define min(u) to be the vertex in R(u) whole label is minimum. Give an O(n + m)-time algorithm that computes min(u) for all vertices u V. Solution: Compute G T in the usual way, so that G T is G with its edges reversed. Then do a depth-first search on G T, but in the main loop of DFS, consider the vertices in order of increasing values of L(v). If vertex u is in the depth-first tree with root v, then min(u) =v. Clearly, this algorithm takes O(V + E) time. Spring 04 CS 2/9

3. Programming Language Design C++ uses pointers to elements of type (say) E as a common alternative to indexes when accessing elements of arrays. Give at least one reason in favor of this scheme and one reason against it (observe that the scheme has been abandoned in Java). C++ (at least most versions) does not guard against a pointer going out of bounds of an array it is indexing. Why not? Could such a check be put into the language as a modification? What would be the cost of doing so? Solution: The indexing can be done, at the target level, with no checking and no conversion of an integer index when the elements of the array occupy other than 1 word. It is thus extremely efficient. There is no conversion from an integer to an index, as would be the case for an integer used as an index on an array whose elements are types occupying more than one word. It is easy to implement in the compiler the generation of target code that will check each pointer applied to an array as an index, in order to ensure that the pointer is in bounds. This requires a run-time check each time the pointer is used as an index on an array, and obliges the use of a separate pointer for each array accessed, which is annoying when (say) two arrays of identical size are being accessed by the same index value. The result is a classic trade-off between efficiency and security. With today s fast processors, the right way is almost always to opt for security, unless every extra cycle needs to be squeezed from the computer. Spring 04 CS 3/9

4. 5. 6. Combinatorics Consider a rectangular box with distinct dimensions. Color the 12 edges B, W, or R. Find the number of inequivalent colorings with 4B, 4W, and 4R edges. Colorings are equivalent with respect to rotations of the box. (Note that since the dimensions are distinct, the rotation must use an angle of 180 degrees and the axis must join the middle of opposite faces.) Solution: P 6 = 1 4 (z12 1 +3z6 2 ), with z 1 = B + W + R and z 2 = B 2 + W 2 + R 2. The coefficient of B 4 W 4 R 4 in 1 4 ((B + W + R)12 +3(B 2 + W 2 + R 2 ) 6 ) is 1 4 (( 12 4, 4, 4 ) ( 6 +3 2, 2, 2 )) = 8730. Find the number of permutations of 1, 2,...,6 in which 1 and 2 are in positions 3,4,5,6; 3 and 4 are in positions 1,2,5,6; and 5 and 6 are in positions 1,2,3,4. Solution: (1+4z +2z 2 ) 3 =1+12z +54z 2 + 112z 3 + 108z 4 +48z 5 +8z 6. Then the answer is 6! 12 5! + 54 4! 112 3! + 108 2! 48 1! + 8 0! = 80. Graph Theory All graphs are simple and undirected. Let H be a subgraph of K n,n with more than (k 1)n edges. Prove that H has a matching of size k. Solution: Each vertex covers at most n edges, hence the minimum number of vertices needed to cover all the edges of H is at least k. By the König-Egerváry theorem, the maximum size of a matching in H is equal to the minimum size of a vertex cover. From this the result follows. Spring 04 CS 4/9

7. Theory of Computation Let Σ = {0, 1}. Construct a DFA for the following language: L = {w w does not contain the substring 00, and w is even}. Explain and justify your construction. Notes: w is the length of w, and substring means a sequence of consecutive symbols. Solution: 0 0 1 1 1 0,1 0,1 0 1 0 8. Let Σ = {0, 1, #}. Construct a CF grammar generating the following language: L = {w # x#w R w, x {0, 1} }. 9. Explain and justify your construction. Solution: S 0 S 0 1 S 1 S S # A # A A 0 A 1 ɛ Symbolic Computation Explain the difference between Int and int in Maple. Give an example to illustrate why we need a command like Int. Solution: 1. Int is the inert Maple command: it just displays the integral, but does not attempt to evaluate the integral, this is done by int. 2. Quite often, a symbolic antiderivative does not exist, and then we must resort to numerical approximation. The command evalf(int(f(x),x=a..b)) immediately computes such a numerical approximation, without first trying to compute a symbolic antiderivative. Spring 04 CS 5/9

10. Numerical Analysis Consider the matrix A = with inverse A 1 = 1.5906E +00 1.1367E 01 8.8133E 01 3.8693E 01 2.7644E 02 2.1440E 01 1.0159E +00 7.2596E 02 5.6290E 01 3.8816E +09 4.5674E +09 7.8171E +09 1.5738E +08 1.8505E +08 3.1690E +08 6.9849E +09 8.2190E +09 1.4067E +10. 1. Estimate the condition number of A using. 1 (the maximum column sum) as norm. 2. For this given matrix A, we now consider the linear system Ax = b, for any general right-hand side vector b, and we forget about the inverse A 1. What is the relation between the relative error on the solution x to Ax = b and the relative error on A? Use cond(a) in your answer. If we want to know the first eight decimal places of x, how accurately must we know A? Justify your answer. Solution: Condition number of A: 1. cond(a) = A 1 A 1 1. Since A 1 1 and A 1 1 10 10, cond(a) 10 10. 2. Let x be the system Āx = b, where Ā is the given A, known with limited precision. Then the relative error on x is estimated by x x x cond(a) A Ā. A For x x to be less than 10 8, A Ā must be less than 10 18, because the condition x A number amplifies errors on A with a factor of 10 10. Thus we must know A with at least 18 decimal places accurately to be sure of the first eight decimal places in x. Spring 04 CS 6/9

11. Suppose we want to approximate the first derivative f (x 0 ) of some function f(x) at the point x 0. 1. Show that the forward-difference approximation using step h>0 is only a first-order approximation in h for f (x 0 ). 2. Develop extrapolation formulas to compute a third-order approximation in h for f (x 0 ), cutting the step h in half each time. Solution: Approximation of f (x 0 ) with forward differences: 1. Using f(x 0 + h) =f(x 0 )+f (x 0 )h + f (x 0 ) 2! h 2 + O(h 3 ), we find the error for the forward difference difference approximation f(x 0,h)as f(x 0,h)= f(x 0 + h) f(x 0 ) h = f (x 0 )+ f (x 0 ) h + O(h 2 ), 2! which shows f(x 0,h) is a first-order approximation in h for f (x 0 ). 2. Cutting h in half each time, we derive f(x 0,h) = f (x 0 )+C 1 h + C 2 h 2 + O(h 3 ) f(x 0,h/2) = f (x 0 )+C 1 h/2+c 2 h 2 /4+O(h 3 ) f(x 0,h/4) = f (x 0 )+C 1 h/4+c 2 h 2 /16 + O(h 3 ) for some constants C 1 and C 2. Elimination of C 1 (or equivalently, the term in h) leads to a second-order approximation: f(x 0, h, h/2) = 2 f(x 0,h/2) f(x 0,h) 2 1 = f (x 0 ) C 2 h 2 /2+O(h 3 ) f(x 0,h/2,h/4) = 2 f(x 0,h/4) f(x 0,h/2) 2 1 = f (x 0 ) C 2 h 2 /8+O(h 3 ) We now see that 4 f(x 0,h/2,h/4) f(x 0,h,h/2) eliminates the term in h 2 and gives us the 4 1 desired third-order approximation for f (x 0 ). Spring 04 CS 7/9

12. Computational Geometry A Star-shaped polygon (SSP) is a simple polygon all of whose interior is visible from at least one point in the polygon s interior. We shall call such a point a point of total visibility (PTV). It is clear that a star-shaped polygon need not be convex. The Kernel of a SSP is a region of its interior containing all of its PTV s. Observe that if the SSP happens to be convex, its kernel will span the entire interior of the SSP. Outline a proof sketch that the kernel of a SSP is a convex polygon inside the SSP. (Hint: Start with a 4-sided polygon with vertex angles 3 of which are convex, turning to the right in a clockwise traversal of the polygon (just like a convex polygon) and 1 of which is reflex (turning to the left). Draw the kernel of this polygon. Now consider how the kernel is constrained when there are several reflex angles. For instance, draw the kernel when there are two reflex angles.) Solution: Suppose it is already known that the polygon P is star-shaped. Consider every reflex vertex v and the two vertices u and w on P. From v extend two half-lines continuing uv and vw. These form a wedge. From any point in the wedge, the inside of both uv and vw are visible; from outside the wedge, they are not both visible. Now reshape the polygon by connectiing w and u, forgetting v. It can be shown easily that P is still star-shaped, and that uw will still not pass through any edge of P. Continue this process until there are no more reflex vertices. The remaining polygon Q is convex, and forms the convex hull of P. The kernel must be the intersection of all the half-planes on either side of the wedges (two per wedge), which is convex, with Q, which is convex, and so finally the kernel is convex. Spring 04 CS 8/9

13. Error-Correcting Codes and Cryptography A binary code C is described by its parity-check matrix H = 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1. (a) How would you encode the messages m 1 = 0000 and m 2 = 1101? (b) How would you decode the received vectors v 1 = 0000111 and v 2 = 0001110? (c) Find the parameters n, k, and d for C. Solution: (a) 00000000 and 1101010 (b) 1000111 and 0011110 (c) [7, 4, 3] 14. In a public-key cryptosystem using RSA, you intercept the cryptogram C = 10 sent to a receiver whose public key is e = 5 and n = 35. Find the integer M that was sent. Solution: p =5,q =7 Hence d is the inverse of 5 mod 24. This is 5 again. So M =10 5 (mod 35) = 5. Spring 04 CS 9/9