Question

10. (10 points) Computational problem solving: Proving correctness: Function g (n: nonnegative integer) if n si then return(n

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Base Case:

Let us assume that n = 1.

Hence, function g returns 1 since n <= 1.

Now, 3n - 2n = 3 - 2 = 1

Clearly, the equality is satisfied for base case n = 1.

Inductive Hypothesis:

Let us assume that for n <= k, the function g(k) returns 3k - 2k and g(k-1) = 3k-1 - 2k-1

Inductive Step:

Now, we would need to show that for n = k + 1, the function g(k + 1) returns 3k+1 - 2k+1.

Proof:

g(k + 1) = 5*g(k) - 6*g(k-1)

= 5 * (3k - 2k) - 6(3k-1 - 2k-1)

= 15*3k-1 - 10*2k-1 - 6*3k-1 + 6*2k-1

= 9*3k-1 - 4*2k-1

= 3k+1 - 2k+1 (proved)

Add a comment
Know the answer?
Add Answer to:
10. (10 points) Computational problem solving: Proving correctness: Function g (n: nonnegative integer) if n si...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem Description proving program correctness Consider the following program specification: Input: An integer n > 0...

    Problem Description proving program correctness Consider the following program specification: Input: An integer n > 0 and an array A[0..(n - 1)] of n integers. Output: The smallest index s such that A[s] is the largest value in A[0..(n - 1)]. For example, if n = 9 and A = [ 4, 8, 1, 3, 8, 5, 4, 7, 2 ] (so A[0] = 4, A[1] = 8, etc.), then the program would return 1, since the largest value in...

  • The symbol N denotes the nonnegative integers, that is, N= {0,1,2,3,...}. The symbol R denotes the...

    The symbol N denotes the nonnegative integers, that is, N= {0,1,2,3,...}. The symbol R denotes the real numbers. In each of the proofs by induction in problems (2), (3), and (4), you must explicitly state and label the goal, the predicate P(n), the base case(s), the proof of the base case(s), the statement of the inductive step, and its proof. Your proofs should have English sentences connecting and justifying the formulas. As an example of the specified format, consider the...

  • Use mathematical induction to prove that the statement is true for every positive integer n. 1'3+...

    Use mathematical induction to prove that the statement is true for every positive integer n. 1'3+ 24 +3'5 +...+() = (n (n+1)(2n+7))/6 a. Define the last term denoted by t) in left hand side equation. (5 pts) b. Define and prove basis step. 3 pts c. Define inductive hypothesis (2 pts) d. Show inductive proof for pik 1) (10 pts)

  • Question 1 result in a grade of zero for the assignment and will bo subject to...

    Question 1 result in a grade of zero for the assignment and will bo subject to disciplinary action. Part I: Strong Induction (50 pt.) (40 pt., 20/10 pt. each) Prove each of the following statements using strong induction. For each statement, answer the following questions. a. (4/2 pt.) Complete the basis step of the proof by showing that the base cases are true. b. (4/2 pt.) What is the inductive hypothesis? C. (4/2 pt.) what do you need to show...

  • Let S(n) be a statement parameterized by a positive integer n. Consider a proof that uses...

    Let S(n) be a statement parameterized by a positive integer n. Consider a proof that uses strong induction to prove that for all n 4.S(n) is true. The base case proves that S(4), S(5), S(6), S(7), and S(8) are all true. Select the correct expressions to complete the statement of what is assumed and proven in the inductive step. Supposed that for k> (1?),s() is true for everyj in the range 4 through k. Then we will show that (22)...

  • ALGORITHM RecS(n) // Input: A nonnegative integer n ifn=0 return 0 else return RecS(n+ n n...

    ALGORITHM RecS(n) // Input: A nonnegative integer n ifn=0 return 0 else return RecS(n+ n n n Determine what this algorithm computes. You must justify your answer. made by this algorithm and solve it. You must justify your answer. same thing using for/while loop(s) developed in (3). You must justify your answer. 1) 2) Set up the initial condition and recurrence relation for the number of multiplications 3) Write the pseudocode for the non-recursive version of this algorithm, i.e., compute...

  • In the following problem, we will work through a proof of an important theorem of arithmetic. Your job will be to read the proof carefully and answer some questions about the argument. Theorem (The Di...

    In the following problem, we will work through a proof of an important theorem of arithmetic. Your job will be to read the proof carefully and answer some questions about the argument. Theorem (The Division Algorithm). For any integer n ≥ 0, and for any positive integer m, there exist integers d and r such that n = dm + r and 0 ≤ r < m. Proof: (By strong induction on the variable n.) Let m be an arbitrary...

  • 3 For each positive integer n, define E(n) 2+4++2n (a) Give a recursive definition for E(n)....

    3 For each positive integer n, define E(n) 2+4++2n (a) Give a recursive definition for E(n). (b) Let P(n) be the statement E(n) nn1)." Complete the steps below to give a proof by induction that P(n) holds for every neZ+ i. Verify P(1) is true. (This is the base step.) ii. Let k be some positive integer. We assume P(k) is true. What exactly are we assuming is true? (This is the inductive hypothesis.) iii. What is the statement P(k...

  • DISCRETE MATHEMATICS Problem 3 (10 points) Use mathematical induction to prove the following statement for all...

    DISCRETE MATHEMATICS Problem 3 (10 points) Use mathematical induction to prove the following statement for all n 21. For full credit, mention the base case (1pt), the induction hypothesis (1 pt) and the induction step (8 pts). 12 22 32

  • 2. In class, we discussed the problem of searching for an item x in a sorted...

    2. In class, we discussed the problem of searching for an item x in a sorted array L with n entries. The returned value is supposed to be -1 if the value x is not in the array, and the index i such that L[i] = x if x is in the array. Assume that I does not contain duplicate values. Now consider the decision trees of algorithms for solving this problem. To make the decision tree more explicit, we...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT