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

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

CS1800 Discrete Structures Final Version A

CS1800 Discrete Structures Final Version B

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

CS1800 Discrete Structures Summer 2017 Prof. Schnyder May 26, CS1800 Discrete Structures Midterm Practice Exam

CS1800 Discrete Structures Spring 2017 Profs. Gold & Schnyder April 28, CS1800 Discrete Structures Final

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

Midterm Exam 2B Answer key

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin

CS 373: Combinatorial Algorithms, Spring 1999

2.) From the set {A, B, C, D, E, F, G, H}, produce all of the four character combinations. Be sure that they are in lexicographic order.

CSE 20 DISCRETE MATH. Fall

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

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

Midterm Exam 2A Principles of Computing Fall November 10, 2014

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

U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions

DESIGN AND ANALYSIS OF ALGORITHMS

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

Discrete Mathematics Lecture 4. Harper Langston New York University

DISCRETE MATHEMATICS

Indicate the option which most accurately completes the sentence.

Final Exam May 6, 2015

Computer Science Foundation Exam

CPSC 311: Analysis of Algorithms (Honors) Exam 1 October 11, 2002

CS521 \ Notes for the Final Exam

Brief History. Graph Theory. What is a graph? Types of graphs Directed graph: a graph that has edges with specific directions

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

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Discrete Mathematics 2 Exam File Spring 2012

END-TERM EXAMINATION

! Addition! Multiplication! Bigger Example - RSA cryptography

CS 161 Fall 2015 Final Exam

MC302 GRAPH THEORY SOLUTIONS TO HOMEWORK #1 9/19/13 68 points + 6 extra credit points

COE428 Lecture Notes Week 1 (Week of January 9, 2017)

Mathematics Masters Examination

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Packet #6: Counting & Graph Theory. Applied Discrete Mathematics

Discrete Mathematics Exam File Fall Exam #1

Midterm 2. Read all of the following information before starting the exam:

Topic 10 Part 2 [474 marks]

Read this before starting!

(Refer Slide Time 3:31)

Faculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University

Computer Science Foundation Exam

(a) Write code to do this without using any floating-point arithmetic. Efficiency is not a concern here.

CS 146 Midterm Exam 2 Grade: Professors Howard, Fine, and Howard have proposed the following sorting algorithm:

OCR H446 A-Level Computer Science

CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes )

CS583 Lecture 01. Jana Kosecka. some materials here are based on Profs. E. Demaine, D. Luebke A.Shehu, J-M. Lien and Prof. Wang s past lecture notes

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

Fall 2018 September 18, Written Homework 02

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

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Discrete Structures. Fall Homework3

CS 112 Final May 8, 2008 (Lightly edited for 2012 Practice) Name: BU ID: Instructions

Midterm CSE 21 Fall 2012

Figure 4.1: The evolution of a rooted tree.

Advanced Algorithms and Data Structures

Introduction to Algorithms May 14, 2003 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser.

OF VICTORIA EXAMINATIONS- DECEMBER 2010 CSC

Solutions to Final. Solutions to Final. May 18th CS170 David Wolfe ALWAYS TRUE SOMETIMES TRUE NEVER TRUE

CSE332 Summer 2010: Final Exam

Problem Score Maximum MC 34 (25/17) = 50 Total 100

CS150 Sample Final. Name: Section: A / B

CSE 20 DISCRETE MATH. Winter

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

Remaining Enhanced Labs

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London

The University of British Columbia


(Refer Slide Time 6:48)

CDS130 Mid-term exam: Sample

Summary of Course Coverage

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

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

6.006 Final Exam Name 2. Problem 1. True or False [30 points] (10 parts) For each of the following questions, circle either True, False or Unknown.

Midterm CSE 21 Spring 2012

CS220/MATH320 Applied Discrete Mathematics Instructor: Marc Pomplun Practice Exam. Sample Solutions

CMPSCI 311: Introduction to Algorithms Practice Final Exam

About the Author. Dependency Chart. Chapter 1: Logic and Sets 1. Chapter 2: Relations and Functions, Boolean Algebra, and Circuit Design

SECTION 5.1. Sequences

D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.

Chapter 2 Bits, Data Types, and Operations

Chapter 2: Number Systems

CS 170 Algorithms Spring 2009 David Wagner MT2

Final Examination CSE 100 UCSD (Practice)

Read this before starting!

OF VICTORIA EXAMINATIONS- DECEMBER 2011 CSC

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

CSC-105 Exam #1 October 10, 2013

CS 4349 Lecture October 18th, 2017

Exercise 1. D-ary Tree

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

COUNTING AND PROBABILITY

UNCA CSCI 255 Exam 1 Spring February, This is a closed book and closed notes exam. It is to be turned in by 1:45 PM.

CS 3L (Clancy) Solutions and grading standards for exam 1

of Nebraska - Lincoln

Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

Transcription:

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, 2016 Instructions: CS1800 Discrete Structures Final 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[12 points] Binary and Hex Section 2 [8 points] Logic and Circuits Section 3 [12 points] Modular Arithmetic and Prime Factors Section 4 [8 points] Sets Section 5 [14 points] Counting Section 6 [12 points] Probability Section 7 [12 points] Sorting, Searching, Sums Section 8 [14 points] Recurrences, Induction, Big-O Section 9 [8 points] Graphs Total Name: NU ID#: Section #: 1

Section 1 [12 pts. (4 each)]: Binary and Hex 1. How many bits are necessary to represent the number 1,000,000 in binary? (You do not need an extra bit for the sign.) 2. If a hex number consisting of 10 digits that are all letters (i.e., values greater than 9, for example, AFEFFABCDE or AAAAAFFFFF) is converted to binary, what is the maximum number of 0 bits that could be in the binary representation? 3. Sum 11100000 and 00100111, assuming two s complement is being used to represent negative numbers. Give the result in decimal. (The last 1 of the first number aligns with the first 1 of the second.) 2

Section 2 [8 pts. (3,2,3)]: Logic and Circuits 1. Use De Morgan s Law to rewrite (A B) (A B) so that the first clause does not use OR and the second clause does not use AND. 2. If C = {x : x A x / B} and D = {x : x / A x B}, what logical operator should go in the blank in the following description? C D = {x : x A x B} (Choose one of: AND, OR, XOR, NAND, NOR) 3. Draw a circuit that takes a 4-bit number and produces its one s complement (a number with all its bits flipped from 0 to 1 and vice versa). Assume a, b, c, d are the input bits from most to least significant, and a, b, c, d are the corresponding output bits; label these in your diagram. 3

Section 3 [12 pts. (4 each)]: Modular Arithmetic and Prime Factors 1. Recall that Fermat s Little Theorem states a p 1 = 1 (mod p) if p is prime, and that if the statement is not true for a, a serves as a witness that p is not prime. (If p is not prime, not every a is a witness.) Determine whether a = 11 is a witness for p = 12, using repeated squaring to find a p 1. You must show your work, including the result of finding a p 1. 2. Find the GCD of 1,000,002 and 60. 3. What is the GCD of 15 20 and a googol (one followed by a hundred zeros)? (You do not need to multiply it out.) 4

Section 4 [8 pts. (3, 5)]: Sets 1. If the universe is Z and N is the natural numbers including 0, describe the complement of N using set builder notation. 2. Use the union, intersection, and complement operators (but not, for example, set difference) to describe the set containing only items that are in exactly one of sets A, B, and C. 5

Section 5 [14 pts. 4, 4, 6]: Counting 1. A website requires users to have usernames with exactly 8 characters, 7 of which must be lowercase letters, and the eighth (which can occur at any position) must either be an uppercase letter or a period. How many possible usernames are there? (You don t need to multiply out the terms.) 2. At a family gathering of 8 people, one relative insists on taking one photo of every possible combination of people, ranging from each person alone to all eight people at once. (Only one photo is necessary per different collection of people, and every photo has at least one person in it. Nobody needs to stand behind the camera; it s on a timer.) How many photos must be taken? 3. Scrabble is a board game in which each player has a rack of 7 letters and tries to come up with high-scoring words to make with them. A friend has written a Scrabble-playing program that is very slow. Examining the code, it looks like the program checks, for every number of tiles k ranging from 1 to 7, all possible permutations of all possible collections of k tiles chosen from the 7 tiles on the rack, checking to see whether each permutation of each collection is a valid word. Write a formula that is a summation from k = 1 to 7 that describes how many permutations this program must check for a given set of 7 tiles. (You can assume the tiles are distinct, and ignore tiles that may already be on the board. Note that 0! is technically 1.) 6

Section 6 [12 pts. 6, 6]: Probability 1. What is the probability of rolling a sum of 4 or less on two six-sided dice? 2. Factory A produces twice as many self-driving cars per year as Factory B, and also has a lower rate of defects: only 3 in 100 cars produced there has a defect, while 6 in 100 cars at factory B have defects. Assume these are the only two factories that produce self-driving cars. Suppose you find a self-driving car produced this year, and it has a defect. What is the probability that it came from factory A? (If it helps you think about the problem, you can assume 3000 self-driving cars have been produced this year. For full credit, show your work using Bayes Theorem.) 7

Section 7 [12 pts. (4 each)]: Sorting, Searching, Sums 1. Consider an array of n distinct values in which the first n 1 values are sorted, and the last element is not. (It could be smaller than the first element, larger than element n 1, or anywhere in between.) Give the worst-case number of comparisons that Insertion Sort will perform in this scenario. You can give your answer in terms of big-theta if you wish to ignore low-order terms and constants. 2. What is the sum of the integers from -60 to 40 inclusive? 3. It so happens that every step of Euclid s algorithm reduces the larger of the two numbers to half its size (or smaller). Use this fact to give a big-o bound on the number of steps Euclid s algorithm must take overall, letting N be the larger of the two original numbers. 8

Section 8 [14 pts. (6, 4, 4)]: Recurrences, Induction, Big-O 1. Prove by induction that n i=1 3n 3 n+1. 2. It s possible to perform a Mergesort that divides the input into four arrays or lists to sort recursively instead of two. The merge of these still takes linear time. Give a recurrence that describes the worst-case running time of this algorithm. You don t have to solve for the running time. 3. Is 4 N = O(3 N )? Use the definition of big-o to show why or why not. 9

Section 9 [8 pts (4 each)]: Graphs 1. List the order in which vertices would be visited for the first time in a depth-first search starting from B in the graph above. If multiple vertices could be explored next, assume the DFS visits the vertex earlier in alphabetical order first; for example, from B, the DFS will visit F before G. 2. Recall that a spanning tree is a tree that connects all the vertices of the graph, and a minimal spanning tree is a spanning tree such that there is no spanning tree on the graph of smaller total weight. Does a minimal spanning tree always contain a cheapest (minimum weight) path between any two nodes in the graph? If so, explain why. If not, give a counterexample that uses four vertices or fewer, circling two vertices with a shortest path that is not in the minimal spanning tree. 10