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

Similar documents
CS1800 Discrete Structures Final Version A

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 27 October, CS1800 Discrete Structures Midterm Version A

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

Math 230 Final Exam, Spring 2008

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

Exam in Discrete Mathematics

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

MATH 363: Discrete Mathematics

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

Fall 2017 September 20, Written Homework 02

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Midterm 2. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

Name: Mathematics 1C03

CS/MATH 111 Winter 2013 Final Test

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

You separate binary numbers into columns in a similar fashion. 2 5 = 32

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Practice Exam Winter 2018, CS 485/585 Crypto March 14, 2018

Discrete Structures, Final Exam

Public Key Cryptography. All secret key algorithms & hash algorithms do the same thing but public key algorithms look very different from each other.

CS483 Design and Analysis of Algorithms

Discrete Mathematics GCD, LCM, RSA Algorithm

Name: Exam 2 Solutions. March 13, 2017

Solutions to the Mathematics Masters Examination

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

Introduction to Public-Key Cryptosystems:

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

MATH 114 Fall 2004 Solutions to practice problems for Final Exam

Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln

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

17.1 Binary Codes Normal numbers we use are in base 10, which are called decimal numbers. Each digit can be 10 possible numbers: 0, 1, 2, 9.

Quiz 2 Solutions Room 10 Evans Hall, 2:10pm Tuesday April 2 (Open Katz only, Calculators OK, 1hr 20mins)

Induction and Recursion

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

CPE 776:DATA SECURITY & CRYPTOGRAPHY. Some Number Theory and Classical Crypto Systems

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1 (Version B)

Fall 2017 November 10, Written Homework 5

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation

Philadelphia University Student Name: Student Number:

*Final Exam* EECS 203 Spring 2015

University of Florida EEL 3701 Fall 2014 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Wednesday, 15 October 2014

Homework 1 Submission

Linear Congruences. The equation ax = b for a, b R is uniquely solvable if a 0: x = b/a. Want to extend to the linear congruence:

Discrete Mathematics and Probability Theory Spring 2015 Vazirani Midterm #2 Solution

Prob. 1 Prob. 2 Prob. 3 Total

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

University of Regina Department of Mathematics & Statistics Final Examination (April 21, 2009)

HOMEWORK #2 - MATH 3260

Computer Science Foundation Exam

Midterm 1 for CS 170

Solutions to the Midterm Test (March 5, 2011)

Induction and recursion. Chapter 5

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

Introduction to Cybersecurity Cryptography (Part 5)

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

EECS 70 Discrete Mathematics and Probability Theory Fall 2015 Walrand/Rao Final

Security II: Cryptography exercises

Discrete Mathematics and Probability Theory Summer 2015 Chung-Wei Lin Midterm 1

University of Florida EEL 3701 Summer 2015 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Tuesday, 30 June 2015

Math 230 Final Exam, Spring 2009

In fact, 3 2. It is not known whether 3 1. All three problems seem hard, although Shor showed that one can solve 3 quickly on a quantum computer.

STUDY GUIDE Math 20. To accompany Intermediate Algebra for College Students By Robert Blitzer, Third Edition

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Practice Final Exam Winter 2017, CS 485/585 Crypto March 14, 2017

*EXAM 1 Answer key* EECS 203 Spring 2016

CMSC Discrete Mathematics FINAL EXAM Tuesday, December 5, 2017, 10:30-12:30

Do not start until you are given the green signal

Admin. ! Will post sample questions soon. 1. Choose a bit-length k. 2. Choose two primes p and q which can be represented with at most k bits

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers

Computer Science Foundation Exam

Quiz 1 Solutions. Problem 2. Asymptotics & Recurrences [20 points] (3 parts)

Implementation of the RSA algorithm and its cryptanalysis. Abstract. Introduction

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Please read carefully. Good luck & Go Gators!!!

Written examination. Tuesday, August 18, 2015, 08:30 a.m.

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

ICS141: Discrete Mathematics for Computer Science I

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications

CS2800 Questions selected for fall 2017

Total Time = 90 Minutes, Total Marks = 50. Total /50 /10 /18

CSI 4105 MIDTERM SOLUTION

F 99 Final Quiz Solutions

Cosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018

CS1800: Hex & Logic. Professor Kevin Gold

Problem Point Value Points

The RSA public encryption scheme: How I learned to stop worrying and love buying stuff online

First Midterm Examination

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

NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt):

Encryption: The RSA Public Key Cipher

Transcription:

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 other electronic device. 2. The exam is worth 100 total points. The points for each problem are given in the problem statement and in the table below. 3. You should write your answers in the space provided; use the back sides of these sheets, if necessary. 4. You have two hours to complete the exam. Section Title Points Section 1[10 points] Binary and Hex Section 2 [10 points] Logic and Circuits Section 3 [12 points] Modular Arithmetic and Prime Factors Section 4 [10 points] Cryptosystems Section 5 [10 points] Sets Section 6 [14 points] Counting Section 7 [10 points] Probability Section 8 [14 points] Induction, Recurrences, Big-O Section 9 [10 points] Algorithms and Graphs Total Name: Instructor: 1

Section 1 [10 pts. (4,3,3)]: Binary and Hex 1. Write the base 10 number 42 in (a) binary, (b) hex. Sol: (a) 101010 (b) 2A 2. Write the decimal number -10 in 8-bit two s complement. Sol: 11110110 3. What is the result (in hex) of multiplying the hex number FFFF by the hex number 10? Sol: FFFF0 2

Section 2 [10 pts. (3,3,4)]: Logic and Circuits 1. Write a logical formula involving the variables x 1, x 2, x 3, and y that evaluates to true if and only if y is true but at least one of the x i variables is false. Use only the operators,, and, and use parentheses as necessary to avoid ambiguity. Sol: y ( x 1 x 2 x 3 ) 2. Simplify the logical expression (x y) (x y) (x z). Sol: x 3. Draw a logical circuit that computes a logical AND of inputs x and y without using any AND gates. Use only OR and NOT gates instead. (Solutions that use more gates than the solution suggested by de Morgan s Law may not receive full credit.) Sol: TODO 3

Section 3 [12 pts. (4,4,4)]: Modular Arithmetic and Prime Factors 1. Find 5 10 mod 7 using repeated squaring. Show your work. Sol: 5 2 mod 7 = 25 mod 7 = 4 5 4 mod 7 = 4 2 mod 7 = 16 mod 7 = 2 5 8 mod 7 = 2 2 mod 7 = 4 5 1 2 mod 7 = 5 8 mod 7 5 4 mod 7 = 4 4 mod 7 = 2 2. Find the multiplicative inverse of 12 mod 91. Sol: gcd(91,12) = gcd(12, 7) = gcd(7,5) = gcd(5,2) = gcd(2,1) = 1 2*0 + 1*1 = 1 5*1 + 2*-2 = 1 7*-2 + 5*3 = 1 12*3 + 7*-5 = 1 91*-5 + 12*38 = 1 38 3. Determine whether 123452 and 12345 are relatively prime. Show your work. (Hint: Factorization is probably too slow.) Sol: Yes, by Euclid s algorithm: 123452 mod 12345 = 2, and 12345 and 2 share no factors because 12345 is odd. 4

Section 4 [10 pts. (3,4,3)]: Cryptosystems 1. What is wrong with the linear cipher y = 13x + 1 mod 26? Sol: 13 is not relatively prime to 26, so there will be values that don t have unique decryptions. 2. If an RSA public key is e = 256, n = 1025, how many multiplications must take place to encrypt a message, assuming you use an efficient algorithm for exponentiation? Sol: 8 3. In choosing a public key e for a particular n = pq, what number must e be relatively prime to, in terms of n and/or p and q? Sol: φ(n) = (p 1)(q 1) 5

Section 5 [10 pts. (3,4,3)]: Sets 1. If A, B, and C are sets that have nonempty intersections with each other, draw a Venn diagram that shades the result of A (B C). Sol: TODO 2. If A = {a, b, c}, what is A P (A)? Sol: 2 3 3 = 24 3. If P = {x : x is prime}, S = {y : y = 7n for some n N}, and T = {z : z = 3n for some n N}, describe in terms of sets P, S, and T (and union, intersection, and complement) the set containing all multiples of 21 and all prime numbers besides 3. Sol: (S T ) (P T ) 6

Section 6 [14 pts. (2,2,2,3,5)]: Counting Consider the following password-like procedures for unlocking a smartphone, and determine how many different passwords (or pass-gestures) are possible under each scheme. You don t need to simplify your answer. 1. A four-digit PIN consisting of digits from the range 0-9. PINs consisting of 4 consecutive digits (such as 1234 and 0123, but not 2468) or 4 identical digits (7777) are not allowed. Sol: 10000-7 - 10 = 9983 2. A swipe that hits four points among nine possible points arranged around the screen. No point can be repeated. (The locations of the points don t matter.) Sol: P(9,4) = 9*8*7*6 3. A scheme where the user must touch 4 points among 9 in any order to unlock the phone. Sol: C(9,4) = 9*8*7*6/4*3*2*1 4. An eight character password, made from 26 uppercase characters, 10 digits, and 12 special characters, that uses at least one special character or digit. Sol: 48 8 26 8 5. A sequence of emoticons that consists of 2 different emoticons, chosen from 100 possibilities, that are pressed a total of 12 times (with identical emoticons not necessarily consecutive). Sequences that just contain one kind of emoticon arent allowed. Sol: C(100, 2) (2 12 2) 7

Section 7 [10 pts. (3,4,3)]: Probability You can leave your answers unsimplified in this section as well. 1. What is the probability that, when rolling two six-sided dice, the two dice show different results from each other? (I.e., the roll is not doubles?) Sol: Six ways to get doubles, so Pr(Doubles) = 6/36 = Pr( Doubles) = 1-6/36 = 5/6 2. In a 44 student class with 20 males and 24 females, three are chosen at random (without replacement) to lead discussion groups. What is the probability that all three students are the same gender as each other? Sol: All males: C(20,3)/C(44,3) All females: C(24,3)/C(44,3) Either: (C(20,3)+C(24,3))/C(44,3) 3. What is the expected number of females picked in the preceding question? (Hint: You can use linearity of expectation here.) Sol: 24/44 * 3 = 6/11 * 3 = 18/11 8

Section 8 [14 pts. (7,3,4)]: Induction, Recurrences, Big-O 1. Prove by induction that, in the following sequence, a n < 2 n for all n 1: a 1 = 1, a 2 = 2, a 3 = 3, a n = a n 1 + a n 2 + a n 3. Sol: Base cases: n = 1 : 1 < 2 1 n = 2 : 2 < 2 2 = 4 n = 3 : 3 < 2 3 = 8 Assume the formula is true for 1 n k. Proof that this implies its truth for n = k + 1: Using the inductive hypothesis to substitute the formula into the formula for a k+1, we get a k+1 = a k + a k 1 + a k 2 < 2 k + 2 k 1 + 2 k 2. We know that this is less than 2 k + 2 k 1 + 2 k 2 +... + 2 0 = 2 k+1 1 since a binary number with all 1 s is 1 less than the next power of two after its largest digit. So a k+1 < 2 k+1 and this proves the formula for n = k + 1. 2. Give the asymptotic (big-theta) running time of an algorithm described by the time recurrence T (N) = 3T (n 1) + 1. Sol: Θ(3 N ) 3. Order the following functions from slowest growing to fastest growing (in terms of big-o): n 2, 10n, 1.01 n, n log 2 n. Sol: 10n, n log 2 n, n 2, 1.01 n 9

Section 9 [10 pts (3, 3, 4)]: Algorithms and Graphs 1. Which is guaranteed to produce a shortest path - breadth-first search, depth-first search, both, or neither? Sol: Breadth-first search 2. Among Insertion Sort, Selection Sort, and Mergesort, (a) which has the best worst-case running time, and (b) which has the best best-case running time? Sol: (a) Mergesort (b) Insertion Sort 3. A Hamiltonian Cycle is a cycle that repeats no vertices and hits every vertex in the graph. Does a graph with a Hamiltonian Cycle always have a spanning tree? If so, explain how to produce such a tree, given a Hamiltonian Cycle. If not, draw a counterexample graph where a Hamiltonian Cycle exists, but no spanning tree exists. Sol: Yes - dropping any edge from the Hamiltonian Cycle produces a spanning tree. 10