Discrete Mathematics and Its Applications with MathZone

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS.6D: Fall 2007, Quiz 5 Solutions 1) [32 points] State whether each of the following is as a recursive definition of some function from nonnegative integers to integers or not. Circle the right answer: a) f(0) = 1, f(n) = f(n – 1) for n ≥ 1 Good one, f(n)=1 for all n≥0 b) f(0) = 1, f(n) = f(n – 2) for n ≥ 1 Failed, because f(1) is “defined” using f(-1) c) f(0) = 1, f(n) = f(n – 2) for n ≥ 2 Failed, because f(1) is undefined. d) f(0) = 1, f(1) = 1, f(n) = f(n – 2) for n ≥ 3 Failed, because f(2) is undefined 2) [36 points] State whether each of the following is a good recursive definition of the set of (all) even positive integers , i.e. {2,4,6,8,10,…}, or not. Circle the right answer: a) 2 S, and if n S then n+2 S. Good One b) 2 S, and if n S then 2*n S. Failed, because e.g. 6 is not in this set S. (Btw, this is a good recursive definition but of a different set, namely S = {2 k | k ≥ 1}.) c) 2 S, and if n 1 S and n 2 S then (n 1 +n 2 ) S. Good One. Note that we can have n 1 =n 2 . 3) [32 points] Here are definitions of (1) a string, (2) a string inverse, and (3) a string bit-wise xor: 1) λ is a string, and s•b is a string for any string s and bit b . 2) inv(λ) = λ , and inv(s•b) = b•inv(s) for any string s and bit b . 3) xor(λ) = 0 , and xor(s•b) = (b+xor(s) mod 2) Fact 4) xor(b•s) = (b+xor(s) mod 2) for any string s and bit b , Using these definitions show by structural induction that xor ( inv(s) ) = xor(s) for any string s : a) [6 points] Base case . First, write the string which you need to consider: ___ Empty string, i.e. λ Now prove that the claim is true for this string: xor(inv( λ )) = xor( λ ) because inv( λ ) = λ by the base case of definition (2). b) [26 points] Inductive case . First, write a string which you need to consider: ___ s•b _______ Now prove that the claim is true for this string assuming it holds for its component(s): xor(inv( s•b )) = xor ( b• inv( s ) ) % by recursive case of definition (2)
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern