MAT 243 Test 2 SOLUTIONS, FORM A
|
|
- Shon Booker
- 5 years ago
- Views:
Transcription
1 MAT 243 Test 2 SOLUTIONS, FORM A 1. [15 points] Calculate the following quantities: a. 17 mod 4 Solution: = = 1. 4 b. 17 div 4 17 Solution: = 4. 4 c. (( 1) mod 12) mod (27 div 5) Solution: (( 1) mod 12) mod (27 div 5) = 11 mod 5 = [10 points] Find real numbers C and k such that 3x 3 + 4x C x 3 whenever x k. Solution: The easiest way to solve this problem is to notice that if x 1, then 3x 3 + 4x x x x 3 + 4x 3 + 8x 3 = 15x 3, so you can let k = 1 and C = 15. Other values were also possible, and can be found by maximizing 3x3 + 4x over the interval [k, ), for some k > 0. (Note that you cannot have k 0, since substituting x = 0 into the desired inequality yields 8 0.) This function is decreasing, so any solution must have C 3+ 4 k + 8 k 3. Grading: done on a point basis. Grading for common mistakes: +3 points (total) for k = 0; +5 points for only giving C or k; +7 points for choosing C 15. x 3 2
2 3. [10 points] Convert 697 to base 7. MAT 243 Test 2 SOLUTIONS, FORM A Solution: Repeatedly divide by 7: 697 = = = = and take the remainders in reverse order: (2014) 7. Grading: Done on a point basis. Grading for common mistakes: +7 points (total) for no work. 4. [15 points] Use mathematical induction to prove that n F 2i = F 2n+1 1 for all n 0, where F n is the Fibonacci sequence (F 0 = 0, F 1 = 1, and F n = F n 1 + F n 2 for all n 2). Solution: Let P (n) be the equation n F 2i = F 2(n)+1 1. P (0) is true, because 0 F 2i = 0 = F 1 1 = F 2(0)+1 1. or Now assume that P (k) is true; that is, F 2i + 1 = F 2(k+1)+1 1. Since F 2i = F 2(k)+1 1. The goal is to prove P (k + 1), k+1 F 2i = F 2i + F 2(k+1) = F 2k F 2k+2 = F 2k+3 1 = F 2(k+1)+1 1, this holds. Thus, by the principle of mathematical induction, P (n) is true for all n 0. Grading: +5 points for the base case, +5 points for the inductive step, +5 points for the conclusion. Grading for common mistakes: +12 points (total) for minor mistakes, +10 points (total) for not being able to complete the inductive step. 3
3 MAT 243 Test 2 SOLUTIONS, FORM A 5. [10 points] Use the Euclidean Algorithm to calculate gcd(843660, 46698). Solution: Okay, I guess you did need a calculator on this test = = = , and the gcd is the last nonzero remainder, or 258. Grading: +9 points for the divisions, +1 points for the answer. Grading for common mistakes: +5 points (total) for finding a prime factorization. 6. [15 points] Let T be the set defined recursively by: (1) 5 T (2) If x T, then 3x T, x + 4 T, and x 8 T (3) The only elements of T are those which are obtained from (1) by applying (2) finitely many times. Prove that for every x T, x is an integer which is not divisible by 4. (Hint: n is not divisible by 4 if n 1 (mod 4), n 2 (mod 4), or n 3 (mod 4).) Solution: First of all, 5 is not divisible by 4; this takes care of the base case. Now suppose that x T and x is not divisible by 4; the goal is to show that 3x, x + 4, and x 8 are not divisible by 4, either. The easiest way to prove this is by considering what x mod 4 is. If x mod 4 = 1, then x 1 (mod 4), and so 3x 3 0, so 3x is not divisible by 4. Also, x + 4 1, so x + 4 is not divisible by 4, either. Lastly, x 8 1, so x 8 is not divisible by 4. Now, if x mod 4 = 2, then x 2 (mod 4). The numbers 3x, x + 4, and x 8 are now (all) equivalent to 2, and so are not divisible by 4. Lastly, if x mod 4 = 3, then x 3 (mod 4), and 3x 1, x + 4 3, and x 8 3. None of these numbers is equivalent to 0 (mod 4), so they are not divisible by 4. This is the last of the cases to consider. Hence, by the principle of structural induction, T does not contain any integers that are divisible by 4. QED. Grading: +5 points for the base case, +5 points for the inductive step, +5 points for the conclusion. This problem was graded very liberally. 4
4 .. MAT 243 Test 2 SOLUTIONS, FORM A 7. [10 points] Give a recursive definition for the set of all (x, y) Z + Z + such that x + y 1 (mod 3). ( Z + is the set of positive integers.) Solution: First of all, 0 is not a positive integer. (That caused quite a few mistakes.) Now, let s draw a picture of some of the elements of this set (which I will call S here.).. From the point (x, y), you can go to the points (x + 3, y),.. (x + 2, y + 1), (x + 1, y + 2), and (x, y + 3) (shown by arrows. above) and still remain in the set S. (Note that if you travel. to (x 1, y + 1), for instance, then you will eventually make the x-coordinate of your point negative; starting at (2, 2), you. would end up at (1, 3), and then (0, 4), which is not in the set.) This gives us the recursive part of the definiton of S. Now you need to determine which points cannot be reached by applying any of the rules above; they turn out to be (1, 3), (2, 2). and (3, 1). Thus, the recursive definition becomes: 1. (1, 3), (2, 2), (3, 1) S. 2. If (x, y) S, then (x + 3, y), (x + 2, y + 1), (x + 1, y + 2), (x, y + 3) S. 3. Only ordered pairs obtained from (1) and using (2) a finite number of times are in S. (Note that the extra ordered pairs (x + 2, y + 1) and (x + 1, y + 2) can be removed as well. There is also symmetry present, so other answers are possible.) Grading: +3 points for the base case, +4 points for the recursive part, +3 points for the finiteness statement. Grading for common mistakes: +5 points (total) for only drawing a picture; 2 points for including points with a zero coordinate; +2 points (total) for not supplying a recursive definition. 8. [15 points] Find a simple function g(n) such that the running time of the following segment of pseudocode is O(g(n)). s 1 k 1 for i from 1 to 3 n do k k + 2 s i k k 1 while k < n do s s + k k 3k s s k Solution: The four assignment statements have a running time of O(1). The for loop has a running time of O( 3 n 1) = O( 3 n), because the loop repeats 3 n times, and every iteration requires time O(1). The while loop repeats at most log 3 n times, so the running time of the while loop is O(log 3 n 1) = O(log 3 n). Lastly, the running time of the entire piece of code is O(max(1, 3 n, log 3 n)) = O( 3 n). Grading for common mistakes: +7 points (total) for O(log n); +10 points for O( 3 n log n); +10 points for O(n) (with n iterations of the while loop); 3 points for not showing any work. 5
5 MAT 243 Test 2 SOLUTIONS, FORM B 1. [15 points] Calculate the following quantities: a. 15 mod 6 Solution: 15 mod 6 = = = 3. 6 b. 15 div 6 Solution: 15 div 6 = 15 = 2. 6 c. (( 2) mod 13) mod (27 div 4) Solution: (( 2) mod 13) mod (27 div 4) = 11 mod 6 = [10 points] Find real numbers C and k such that 7x 4 + 5x C x 4 whenever x k. Solution: The easiest way to solve this problem is to notice that if x 1, then 7x 4 + 5x x x x 3 + 5x 3 + 9x 3 = 21x 3, so you can let k = 1 and C = 21. Other values were also possible, and can be found by maximizing 7x4 + 5x over the interval [k, ), for some k > 0. (Note that you cannot have k 0, since substituting x = 0 into the desired inequality yields 9 0.) This function is decreasing, so any solution must have C 7+ 5 k + 9 k 4. Grading: done on a point basis. Grading for common mistakes: +3 points (total) for k = 0; +5 points for only giving C or k; +7 points for choosing C 21. x 4 2
6 3. [10 points] Convert 442 to base 6. MAT 243 Test 2 SOLUTIONS, FORM B Solution: Repeatedly divide by 6: 442 = = = = and take the remainders in reverse order: (2014) 6. Grading: Done on a point basis. Grading for common mistakes: +7 points (total) for no work. 4. [15 points] Use mathematical induction to prove that n F 2i+1 = F 2n+2 for all n 0, where F n is the Fibonacci sequence (F 0 = 0, F 1 = 1, and F n = F n 1 + F n 2 for all n 2). Solution: Let P (n) be the equation n F 2i+1 = F 2(n)+2. P (0) is true, because 0 F 2i+1 = 1 = F 2(0)+2. Now assume that P (k) is true; that is, F 2i = F 2(k+1)+2. Since F 2i+1 = F 2(k)+2. The goal is to prove P (k + 1), or k+1 F 2i+1 = F 2i+1 + F 2(k+1)+1 = F 2k+2 + F 2k+3 = F 2k+4, this holds. Thus, by the principle of mathematical induction, P (n) is true for all n 0. Grading: +5 points for the base case, +5 points for the inductive step, +5 points for the conclusion. Grading for common mistakes: +12 points (total) for minor mistakes, +10 points (total) for not being able to complete the inductive step. 3
7 MAT 243 Test 2 SOLUTIONS, FORM B 5. [10 points] Use the Euclidean Algorithm to calculate gcd(879231, 72891). Solution: Okay, I guess you did need a calculator on this test = = = , and the gcd is the last nonzero remainder, or 267. Grading: +9 points for the divisions, +1 points for the answer. Grading for common mistakes: +5 points (total) for finding a prime factorization. 6. [15 points] Let T be the set defined recursively by: (1) 4 T (2) If x T, then 2x T, x + 3 T, and x 6 T (3) The only elements of T are those which are obtained from (1) by applying (2) finitely many times. Prove that for every x T, x is an integer which is not divisible by 3. (Hint: n is not divisible by 3 if n 1 (mod 3) or n 2 (mod 3).) Solution: First of all, 4 is not divisible by 3; this takes care of the base case. Now suppose that x T and x is not divisible by 3; the goal is to show that 2x, x + 3, and x 6 are not divisible by 3, either. The easiest way to prove this is by considering what x mod 3 is. If x mod 3 = 1, then x 1 (mod 3), and so 2x 2 0, so 2x is not divisible by 3. Also, x + 3 1, so x + 3 is not divisible by 3, either. Lastly, x 6 1, so x 6 is not divisible by 3. Now, if x mod 3 = 2, then x 2 (mod 3). The numbers 2x, x + 3, and x 6 are now equivalent to 1, 2, and 2, in that order, and so are not divisible by 3. Hence, by the principle of structural induction, T does not contain any integers that are divisible by 3. QED. Grading: +5 points for the base case, +5 points for the inductive step, +5 points for the conclusion. This problem was graded very liberally. 4
8 MAT 243 Test 2 SOLUTIONS, FORM B 7. [10 points] Give a recursive definition for the set of all (x, y) Z + Z + such that x + y 3 (mod 4). ( Z + is the set of positive integers.) Solution: First of all, 0 is not a positive integer. (That caused quite a few mistakes.) Now, let s draw a picture of some of the elements of this set (which I will call S here.).. From the point (x, y), you can go to the points (x + 4, y),.. (x + 3, y + 1), (x + 2, y + 2), (x + 1, y + 3), and (x, y + 4) (shown.. by arrows above) and still remain in the set S. (Note that if you.. travel to (x 1, y+1), for instance, then you will eventually make the x-coordinate of your point negative; starting at (2, 1), you.. would end up at (1, 2), and then (0, 3), which is not in the set.). This gives us the recursive part of the definiton of S. Now you need to determine which points cannot be reached by applying any of the rules above; they turn out to be (2, 1) and. (1, 2). Thus, the recursive definition becomes: 1. (1, 2), (2, 1) S. 2. If (x, y) S, then (x + 4, y), (x + 3, y + 1), (x + 2, y + 2), (x + 1, y + 3), (x, y + 4) S. 3. Only ordered pairs obtained from (1) and using (2) a finite number of times are in S. (Note that the extra ordered pairs (x + 3, y + 1) and (x + 1, y + 3) can be removed as well. There is also symmetry present, so other answers are possible.) Grading: +3 points for the base case, +4 points for the recursive part, +3 points for the finiteness statement. Grading for common mistakes: +5 points (total) for only drawing a picture; 2 points for including points with a zero coordinate; +2 points (total) for not supplying a recursive definition. 8. [15 points] Find a simple function g(n) such that the running time of the following segment of pseudocode is O(g(n)). s 0 k 1 while k n do s s + k 2 k 2k for i from 1 to n DO s i s + 3 s s/k Solution: The three assignment statements have a running time of O(1). The while loop repeats at most log 2 n times, so the running time of the while loop is O(log 2 n 1) = O(log 2 n). The for loop has a running time of O( n 1) = O( n), because the loop repeats n times, and every iteration requires time O(1). Lastly, the running time of the entire piece of code is O(max(1, n, log 2 n)) = O( n). Grading for common mistakes: +7 points (total) for O(log n); +10 points for O( 3 n log n); +10 points for O(n) (with n iterations of the while loop); 3 points for not showing any work. 5
SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION
CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 5.5 Application: Correctness of Algorithms Copyright Cengage Learning. All
More informationSEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION
CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Copyright Cengage Learning. All rights reserved. SECTION 5.5 Application: Correctness of Algorithms Copyright Cengage Learning. All rights reserved.
More informationELEMENTARY NUMBER THEORY AND METHODS OF PROOF
CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.8 Application: Algorithms Copyright Cengage Learning. All rights reserved. Application:
More informationPiecewise Defined Functions
Piecewise Defined Functions Most of the functions that we ve looked at this semester can be expressed as a single equation. For example, f(x) =3x 2 5x +2,org(x) = x 1, or h(x) =e 3x 1. Sometimes an equation
More informationCOE428 Lecture Notes Week 1 (Week of January 9, 2017)
COE428 Lecture Notes: Week 1 1 of 10 COE428 Lecture Notes Week 1 (Week of January 9, 2017) Table of Contents COE428 Lecture Notes Week 1 (Week of January 9, 2017)...1 Announcements...1 Topics...1 Informal
More informationECE G205 Fundamentals of Computer Engineering Fall Exercises in Preparation to the Midterm
ECE G205 Fundamentals of Computer Engineering Fall 2003 Exercises in Preparation to the Midterm The following problems can be solved by either providing the pseudo-codes of the required algorithms or the
More informationOdd-Numbered Answers to Exercise Set 1.1: Numbers
Odd-Numbered Answers to Exercise Set.: Numbers. (a) Composite;,,, Prime Neither (d) Neither (e) Composite;,,,,,. (a) 0. 0. 0. (d) 0. (e) 0. (f) 0. (g) 0. (h) 0. (i) 0.9 = (j). (since = ) 9 9 (k). (since
More informationSECTION 5.1. Sequences
SECTION 5.1 Sequences Sequences Problem: count number of ancestors one has 2 parents, 4 grandparents, 8 greatgrandparents,, written in a row as 2, 4, 8, 16, 32, 64, 128, To look for pattern of the numbers,
More information1. (15 points) Solve the decanting problem for containers of sizes 199 and 179; that is find integers x and y satisfying.
May 9, 2003 Show all work Name There are 260 points available on this test 1 (15 points) Solve the decanting problem for containers of sizes 199 and 179; that is find integers x and y satisfying where
More informationCHAPTER 8. Copyright Cengage Learning. All rights reserved.
CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation
More informationCSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4
CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University Name: ID#: Section #: Score: / 4 Unit 7: Direct Proof Introduction 1. The statement below is true. Rewrite the
More informationCourse Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System
UNIT I STUDY GUIDE Number Theory and the Real Number System Course Learning Outcomes for Unit I Upon completion of this unit, students should be able to: 2. Relate number theory, integer computation, and
More informationIntegers and Mathematical Induction
IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about
More informationSolutions to the Second Midterm Exam
CS/Math 240: Intro to Discrete Math 3/27/2011 Instructor: Dieter van Melkebeek Solutions to the Second Midterm Exam Problem 1 This question deals with the following implementation of binary search. Function
More informationELEMENTARY NUMBER THEORY AND METHODS OF PROOF
CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights
More informationLecture 3.4: Recursive Algorithms
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag Course Admin Graded Mid-Term 1 Please pick them up, if you haven
More informationELEMENTARY NUMBER THEORY AND METHODS OF PROOF
CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights
More informationTopic 10 Part 2 [474 marks]
Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed
More informationFramework for Design of Dynamic Programming Algorithms
CSE 441T/541T Advanced Algorithms September 22, 2010 Framework for Design of Dynamic Programming Algorithms Dynamic programming algorithms for combinatorial optimization generalize the strategy we studied
More informationIntroduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD
Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD In this session, we will write another algorithm to solve a mathematical problem. If you
More informationDivisibility Rules and Their Explanations
Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although
More informationMath 221 Final Exam Review
Math 221 Final Exam Review Preliminary comment: Some of these problems a formulated using language and structures from graph theory. However they are generally self contained; no theorems from graph theory
More informationCS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK
CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Page 1 UNIT I INTRODUCTION 2 marks 1. Why is the need of studying algorithms? From a practical standpoint, a standard set of algorithms from different
More informationScan Scheduling Specification and Analysis
Scan Scheduling Specification and Analysis Bruno Dutertre System Design Laboratory SRI International Menlo Park, CA 94025 May 24, 2000 This work was partially funded by DARPA/AFRL under BAE System subcontract
More informationDivision. Reverse Box Method
Division Reverse Box Method Why do we use the reverse box method? The box method of multiplication is used because it develops a strong conceptual understanding of multiplication! If you have not read
More information3.7. Vertex and tangent
3.7. Vertex and tangent Example 1. At the right we have drawn the graph of the cubic polynomial f(x) = x 2 (3 x). Notice how the structure of the graph matches the form of the algebraic expression. The
More informationChapter 3 Programming with Recursion
Plan Chapter 3 Programming with Recursion 1. Examples... 3.2 2. Correctness... 3.5 3. Construction methodology... 3.13 4. Forms of recursion... 3.16 Sven-Olof Nyström/IT Dept/Uppsala University FP 3.1
More informationASSIGNMENT 4 SOLUTIONS
MATH 71 ASSIGNMENT SOLUTIONS 1. If F : X X is a function, define f (x) to be (f f)(x), and inductively define f k (x) (f f k 1 )(x) for each integer k. (So f (x) (f f )(x) f(f(f(x))) for instance.) We
More informationExam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE
Exam Datastrukturer DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE Day: 2018-10-12, Time: 8:30-12.30, Place: SB Course responsible Alex Gerdes, tel. 031-772 6154. Will visit at around 9:30 and 11:00.
More informationCantor s Diagonal Argument for Different Levels of Infinity
JANUARY 2015 1 Cantor s Diagonal Argument for Different Levels of Infinity Michael J. Neely University of Southern California http://www-bcf.usc.edu/ mjneely Abstract These notes develop the classic Cantor
More information#23: Sequences March 28, 2009
#23: Sequences March 28, 2009 a mysterious rule easy peasy Suppose n is an integer, and consider this simple rule: if n is even, divide it by two; otherwise, multiply n by 3, and add one. Pretty simple,
More information2009 HMMT Team Round. Writing proofs. Misha Lavrov. ARML Practice 3/2/2014
Writing proofs Misha Lavrov ARML Practice 3/2/2014 Warm-up / Review 1 (From my research) If x n = 2 1 x n 1 for n 2, solve for x n in terms of x 1. (For a more concrete problem, set x 1 = 2.) 2 (From this
More informationCSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions. User Defined Functions
CSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions User Defined Functions In previous labs, you've encountered useful functions, such as sqrt() and pow(), that were created by other
More informationPROBLEM SOLVING TECHNIQUES SECTION - A. 1. Answer any ten of the following
PROBLEM SOLVING TECHNIQUES SECTION - A 1. Answer any ten of the following a. Define an algorithm. An algorithm is a finite set of instructions that if followed, accomplishes a particular task. b. Define
More informationLoops / Repetition Statements
Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for
More information2. CONNECTIVITY Connectivity
2. CONNECTIVITY 70 2. Connectivity 2.1. Connectivity. Definition 2.1.1. (1) A path in a graph G = (V, E) is a sequence of vertices v 0, v 1, v 2,..., v n such that {v i 1, v i } is an edge of G for i =
More informationCS 173 [A]: Discrete Structures, Fall 2012 Homework 8 Solutions
CS 173 [A]: Discrete Structures, Fall 01 Homework 8 Solutions This homework contains 4 problems worth a total of 35 points. It is due on Wednesday, November 14th, at 5pm. 1 Induction Proofs With Inequalities
More informationDOWNLOAD PDF BIG IDEAS MATH VERTICAL SHRINK OF A PARABOLA
Chapter 1 : BioMath: Transformation of Graphs Use the results in part (a) to identify the vertex of the parabola. c. Find a vertical line on your graph paper so that when you fold the paper, the left portion
More informationAlgorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48
Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More informationCS 310 Advanced Data Structures and Algorithms
CS 310 Advanced Data Structures and Algorithms Recursion June 27, 2017 Tong Wang UMass Boston CS 310 June 27, 2017 1 / 20 Recursion Recursion means defining something, such as a function, in terms of itself
More informationCIS 194: Homework 6. Due Monday, February 25. Fibonacci numbers
CIS 194: Homework 6 Due Monday, February 25 Files you should submit: Fibonacci.hs This week we learned about Haskell s lazy evaluation. This homework assignment will focus on one particular consequence
More informationDISCRETE MATHEMATICS
DISCRETE MATHEMATICS WITH APPLICATIONS THIRD EDITION SUSANNA S. EPP DePaul University THOIVISON * BROOKS/COLE Australia Canada Mexico Singapore Spain United Kingdom United States CONTENTS Chapter 1 The
More informationIt is important that you show your work. There are 134 points available on this test.
Math 1165 Discrete Math Test April 4, 001 Your name It is important that you show your work There are 134 points available on this test 1 (10 points) Show how to tile the punctured chess boards below with
More informationCOP 4516: Math for Programming Contest Notes
COP 4516: Math for Programming Contest Notes Euclid's Algorithm Euclid's Algorithm is the efficient way to determine the greatest common divisor between two integers. Given two positive integers a and
More informationAgenda. The worst algorithm in the history of humanity. Asymptotic notations: Big-O, Big-Omega, Theta. An iterative solution
Agenda The worst algorithm in the history of humanity 1 Asymptotic notations: Big-O, Big-Omega, Theta An iterative solution A better iterative solution The repeated squaring trick Fibonacci sequence 2
More informationRecursion. Tjark Weber. Functional Programming 1. Based on notes by Sven-Olof Nyström. Tjark Weber (UU) Recursion 1 / 37
Tjark Weber Functional Programming 1 Based on notes by Sven-Olof Nyström Tjark Weber (UU) Recursion 1 / 37 Background FP I / Advanced FP FP I / Advanced FP This course (Functional Programming I) (5 hp,
More informationA catalogue of proofs that various sets, functions and relations are primitive recursive 26 February 2012 at 20:57
A catalogue of proofs that various sets, functions and relations are primitive recursive 26 February 2012 at 20:57 Public In this note (which is mainly intended as a 'memo' for myself) I am interested
More informationCOMPUTER SCIENCE TRIPOS
CST.2000.1.1 COMPUTER SCIENCE TRIPOS Part IA Monday 5 June 2000 1.30 to 4.30 Paper 1 Answer two questions from Section A, and one question from each of Sections B, C, D and E. Submit the answers in six
More informationFundamental mathematical techniques reviewed: Mathematical induction Recursion. Typically taught in courses such as Calculus and Discrete Mathematics.
Fundamental mathematical techniques reviewed: Mathematical induction Recursion Typically taught in courses such as Calculus and Discrete Mathematics. Techniques introduced: Divide-and-Conquer Algorithms
More informationFor 100% Result Oriented IGNOU Coaching and Project Training Call CPD: ,
ASSIGNMENT OF MCS-031(ADA) Question 1: (a) Show, through appropriate examples or otherwise, that the following three characteristics of an algorithm are independent (i) finiteness An algorithm must terminate
More informationCalculation of extended gcd by normalization
SCIREA Journal of Mathematics http://www.scirea.org/journal/mathematics August 2, 2018 Volume 3, Issue 3, June 2018 Calculation of extended gcd by normalization WOLF Marc, WOLF François, LE COZ Corentin
More informationSolutions to Problem 1 of Homework 3 (10 (+6) Points)
Solutions to Problem 1 of Homework 3 (10 (+6) Points) Sometimes, computing extra information can lead to more efficient divide-and-conquer algorithms. As an example, we will improve on the solution to
More information1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:
P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string
More informationNumber Theory Algorithms
Number Theory Algorithms Zeph Grunschlag Copyright Zeph Grunschlag, 2 22. Agenda Euclidean Algorithm for GCD Number Systems Decimal numbers (base ) Binary numbers (base 2) One s complement Two s complement
More informationRecursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences
Section 5.3 1 Recursion 2 Recursion Recursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences Previously sequences were defined using a specific
More informationRecursion. Lars-Henrik Eriksson. Functional Programming 1. Based on a presentation by Tjark Weber and notes by Sven-Olof Nyström
Lars-Henrik Eriksson Functional Programming 1 Based on a presentation by Tjark Weber and notes by Sven-Olof Nyström Tjark Weber (UU) Recursion 1 / 41 Comparison: Imperative/Functional Programming Comparison:
More informationRATIONAL FUNCTIONS Introductory Material from Earl Please read this!
RATIONAL FUNCTIONS Introductory Material from Earl Please read this! In working with rational functions, I tend to split them up into two types: Simple rational functions are of the form or an equivalent
More informationThe Chinese remainder theorem
Mathematics, KTH Bengt Ek October 2015 Supplementary material for SF2736, Discrete mathematics: The Chinese remainder theorem We know that for all m Z + and all a Z, all integers x that satisfy x a (mod
More informationPythagorean Triples. Chapter 2. Exercises
Chapter Pythagorean Triples Exercises.1. (a) We showed that in any primitive Pythagorean triple (a, b, c), either a or b is even. Use the same sort of argument to show that either a or b must be a multiple
More informationIntroduction to Modular Arithmetic
Randolph High School Math League 2014-2015 Page 1 1 Introduction Introduction to Modular Arithmetic Modular arithmetic is a topic residing under Number Theory, which roughly speaking is the study of integers
More informationUNIT 1 BASICS OF AN ALGORITHM
UNIT 1 BASICS OF AN ALGORITHM Basics of an Algorithm Structure Page Nos. 1.0 Introduction 5 1.1 Objectives 6 1.2. Analysis and Complexity of Algorithms 6 1.3 Basic Technique for Design of Efficient Algorithms
More informationMath Introduction to Advanced Mathematics
Math 215 - Introduction to Advanced Mathematics Number Theory Fall 2017 The following introductory guide to number theory is borrowed from Drew Shulman and is used in a couple of other Math 215 classes.
More informationHW 1 CMSC 452. Morally DUE Feb 7 NOTE- THIS HW IS THREE PAGES LONG!!! SOLUTIONS THROUGOUT THIS HW YOU CAN ASSUME:
HW 1 CMSC 452. Morally DUE Feb 7 NOTE- THIS HW IS THREE PAGES LONG!!! SOLUTIONS THROUGOUT THIS HW YOU CAN ASSUME: The union of a finite number of countable sets is countable. The union of a countable number
More informationOutline. Introduction. 2 Proof of Correctness. 3 Final Notes. Precondition P 1 : Inputs include
Outline Computer Science 331 Correctness of Algorithms Mike Jacobson Department of Computer Science University of Calgary Lectures #2-4 1 What is a? Applications 2 Recursive Algorithms 3 Final Notes Additional
More informationFall Recursion and induction. Stephen Brookes. Lecture 4
15-150 Fall 2018 Stephen Brookes Lecture 4 Recursion and induction Last time Specification format for a function F type assumption guarantee (REQUIRES) (ENSURES) For all (properly typed) x satisfying the
More informationAssertions & Verification & Example Loop Invariants Example Exam Questions
2014 November 27 1. Assertions & Verification & Example Loop Invariants Example Exam Questions 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer
More informationBulgarian Math Olympiads with a Challenge Twist
Bulgarian Math Olympiads with a Challenge Twist by Zvezdelina Stankova Berkeley Math Circle Beginners Group September 0, 03 Tasks throughout this session. Harder versions of problems from last time appear
More informationChapter 4. Number Theory. 4.1 Factors and multiples
Chapter 4 Number Theory We ve now covered most of the basic techniques for writing proofs. So we re going to start applying them to specific topics in mathematics, starting with number theory. Number theory
More informationSolutions to Exercises 9
Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 9 (1) There are 5 cities. The cost of building a road directly between i and j is the entry a i,j in the matrix below. An indefinite entry indicates
More informationCPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00
CPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00 [18] 1. Consider the following predicate logic statement: 9x 2 A, 8y 2 B,9z 2 C, P(x, y, z)! Q(x, y, z), where A, B,
More information1 Elementary number theory
Math 215 - Introduction to Advanced Mathematics Spring 2019 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...},
More informationLecture 34: Curves defined by Parametric equations
Curves defined by Parametric equations When the path of a particle moving in the plane is not the graph of a function, we cannot describe it using a formula that express y directly in terms of x, or x
More informationIntroduction to Sets and Logic (MATH 1190)
Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set
More informationGateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 3-6
NUMBER SENSE & OPERATIONS 3.N.1 Exhibit an understanding of the values of the digits in the base ten number system by reading, modeling, writing, comparing, and ordering whole numbers through 9,999. Our
More informationAgenda. We ve done Growth of functions Asymptotic Notations (O, o,,!, ) Now Binary search as an example Recurrence relations, solving them
Agenda We ve done Growth of functions Asymptotic Notations (O, o,,!, ) Now Binary search as an example Recurrence relations, solving them c Hung Q. Ngo (SUNY at Buffalo) CSE 250 Data Structures in C++
More informationAssertions & Verification Example Exam Questions
2009 November 23 Assertions & Verification Example Exam Questions 1. 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer must answer to verify
More informationMathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015
Mathematics Jaehyun Park CS 97SI Stanford University June 29, 2015 Outline Algebra Number Theory Combinatorics Geometry Algebra 2 Sum of Powers n k=1 k 3 k 2 = 1 n(n + 1)(2n + 1) 6 = ( k ) 2 = ( 1 2 n(n
More informationLOOPS. Repetition using the while statement
1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while
More information1. Find f(1), f(2), f(3), and f(4) if f(n) is defined recursively by f(0) = 1 and for n = 0, 1, 2,
Exercises Exercises 1. Find f(1), f(2), f(3), and f(4) if f(n) is defined recursively by f(0) = 1 and for n = 0, 1, 2, a) f(n + 1) = f(n) + 2. b) f(n + 1) = 3f(n). c) f(n + 1) = 2f(n). d) f(n + 1) = f(n)2
More information392D: Coding for the AWGN Channel Wednesday, March 21, 2007 Stanford, Winter 2007 Handout #26. Final exam solutions
92D: Coding for the AWGN Channel Wednesday, March 2, 27 Stanford, Winter 27 Handout #26 Problem F. (8 points) (Lexicodes) Final exam solutions In this problem, we will see that a simple greedy algorithm
More informationRational numbers as decimals and as integer fractions
Rational numbers as decimals and as integer fractions Given a rational number expressed as an integer fraction reduced to the lowest terms, the quotient of that fraction will be: an integer, if the denominator
More informationBasics of Computational Geometry
Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals
More informationBEng (Hons) Telecommunications. Examinations for / Semester 2
BEng (Hons) Telecommunications Cohort: BTEL/14B/FT Examinations for 2014-2015 / Semester 2 MODULE: NUMBERS, LOGICS AND GRAPHS THEORIES MODULE CODE: Duration: 3 Hours Instructions to Candidates: 1 Answer
More informationCSE 20 DISCRETE MATH. Winter
CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam
More information31.6 Powers of an element
31.6 Powers of an element Just as we often consider the multiples of a given element, modulo, we consider the sequence of powers of, modulo, where :,,,,. modulo Indexing from 0, the 0th value in this sequence
More informationAlgorithms Activity 6: Applications of BFS
Algorithms Activity 6: Applications of BFS Suppose we have a graph G = (V, E). A given graph could have zero edges, or it could have lots of edges, or anything in between. Let s think about the range of
More information16.10 Exercises. 372 Chapter 16 Code Improvement. be translated as
372 Chapter 16 Code Improvement 16.10 Exercises 16.1 In Section 16.2 we suggested replacing the instruction r1 := r2 / 2 with the instruction r1 := r2 >> 1, and noted that the replacement may not be correct
More informationHomework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017
Homework 1 Due 14 February Handout 3 CSCI 334: Spring, 2017 Notes This homework has three types of problems: Self Check: You are strongly encouraged to think about and work through these questions, but
More informationMath 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)
Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.
More informationMC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points
MC 0 GRAPH THEORY 0// Solutions to HW # 0 points + XC points ) [CH] p.,..7. This problem introduces an important class of graphs called the hypercubes or k-cubes, Q, Q, Q, etc. I suggest that before you
More information0.1 Welcome. 0.2 Insertion sort. Jessica Su (some portions copied from CLRS)
0.1 Welcome http://cs161.stanford.edu My contact info: Jessica Su, jtysu at stanford dot edu, office hours Monday 3-5 pm in Huang basement TA office hours: Monday, Tuesday, Wednesday 7-9 pm in Huang basement
More informationDiscrete Mathematics Lecture 4. Harper Langston New York University
Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a
More information9-1 GCSE Maths. GCSE Mathematics has a Foundation tier (Grades 1 5) and a Higher tier (Grades 4 9).
9-1 GCSE Maths GCSE Mathematics has a Foundation tier (Grades 1 5) and a Higher tier (Grades 4 9). In each tier, there are three exams taken at the end of Year 11. Any topic may be assessed on each of
More informationCS 506, Sect 002 Homework 5 Dr. David Nassimi Foundations of CS Due: Week 11, Mon. Apr. 7 Spring 2014
CS 506, Sect 002 Homework 5 Dr. David Nassimi Foundations of CS Due: Week 11, Mon. Apr. 7 Spring 2014 Study: Chapter 4 Analysis of Algorithms, Recursive Algorithms, and Recurrence Equations 1. Prove the
More informationRecursive Definitions Structural Induction Recursive Algorithms
Chapter 4 1 4.3-4.4 Recursive Definitions Structural Induction Recursive Algorithms 2 Section 4.1 3 Principle of Mathematical Induction Principle of Mathematical Induction: To prove that P(n) is true for
More informationReasoning and writing about algorithms: some tips
Reasoning and writing about algorithms: some tips Theory of Algorithms Winter 2016, U. Chicago Notes by A. Drucker The suggestions below address common issues arising in student homework submissions. Absorbing
More informationCSE 20 DISCRETE MATH WINTER
CSE 20 DISCRETE MATH WINTER 2016 http://cseweb.ucsd.edu/classes/wi16/cse20-ab/ Today's learning goals Explain the steps in a proof by (strong) mathematical induction Use (strong) mathematical induction
More informationHandout 9: Imperative Programs and State
06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative
More informationCSE Winter 2015 Quiz 1 Solutions
CSE 101 - Winter 2015 Quiz 1 Solutions January 12, 2015 1. What is the maximum possible number of vertices in a binary tree of height h? The height of a binary tree is the length of the longest path from
More information