Question-80 Give a recursive algorithm for finding the maximum of a finite set of integers , making use of the fact that the maximum of n integers is the larger…
Question-79
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…
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…
Question-72
Question-72 Prove that if A1 , A2 , …. , An and B1 , B2 … Bn are sets such that Aj Bj for j = 1, 2 ,…, n,…
Question-71
Question-71 Use mathematical induction to prove that 3 divides + 2 n whenever n is a positive integer. solution The statement is true for the base case, n…
Recent Comments