Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For 3b and 3c, follow the induction format and use Big Oh notation O(n), Omega notation (n), or Theta notation (n) for the time complexity.
For 3b and 3c, follow the induction format and use Big Oh notation O(n), Omega notation (n), or Theta notation (n) for the time complexity. Also, you should count only the number of times that the addition operation is called. This is the same as asking how many times the last line of the pseudocode will be executed when C(n,1) is queried. You should be able to provide an exact formula for this value.
The following code computes an entry in Pascal's Triangle. Algorithm 2: Pascal's Triangle Function C(n,k) : Input: n a positive integer, k an integer between 0 and n Output: k!(nk)!n! If n=1 or k=0 or k=n : L Return 1 Return C(n1,k1)+C(n1,k) (a) (5 points) Use induction to prove that for any n1, C(n,k)=k!(nk)!n!forallk{0,1,,n} This will establish correctness of the algorithm. Note that 0!=1. Hint: in order to apply induction as described in class, let H(n) be the claim in (1). Solution: (b) (5 points) Find the time complexity of computing C(n,1). Do this by finding a formula for the total number of additions performed in computing C(n,1). Use induction to justify your answer. Solution: (c) (5 points) Find the time complexity of computing C(n,2). Do this by finding a formula for the total number of additions performed in computing C(n,2). Use induction to justify your answer. SolutionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started