Question-79 Give a recursive algorithm for finding the sum of the first n positive integers. Solution procedure sum of first (n : positive integer) if n = 1 then…
Month: April 2014
Question-78
Question-78 A Recursive Algorithm for Computing n! Procedure factorial (n : nonnegative integer) if n = 0 then return 1 else return n ·factorial (n – 1 ) { output…
Question-77
Question-77 Give a recursive definition of the set of positive integers that are multiples of 5. Solution 5 S , and 5x S if x S .
Question-76
Question-76 Let fn be the nth Fibonacci number. Prove that when n is a positive integer. Solution The basis step (n = 1) is clear, since = 1 . Assume the…
Question-75
Question-75 Give a recursive definition of the sequence {an} , n = 1, 2, 3, …… if a) an = 4n – 2. b) an = 3 + 3.(-1)n. c) …
Question-74
Question-74 Determine whether each of these proposed definitions is a valid recursive definitions of a function f from the set of nonnegative to the set of integers. If f is…
Question-73
Question-73 Find f (2), f(3), f(4), and f(5) if f is defined recursively by f(0) = -1, f(1) = 2, and for n = 1, 2, … a) f (n…
Recent Comments