Question 6)
Answer:

2T(n/2 )is due to two recursive calls made for A(n/2)
is due to the for loop which runs from i = 1 to n
You can also write the answer as:

Since there is only one for loop.
-----------------------------------------------------------
Question 7)
Answer:

T(n/2 )is due to one recursive calls made for A(n/2)
is due to the for loop which runs from i = 1 to n
You can also write the answer as:

Since there is only one for loop.
-----------------------------------------------------------
Question 8)
Answer:

2T(n/4 )is due to two recursive calls made for A(n/4)
is due to the for loop which runs from i = 1 to n
You can also write the answer as:

Since there is only one for loop.
-----------------------------------------------------------
I hope this helps you,
Please rate this answer if it helped you,
Thanks for the opportunity
QUESTION 6 Given algorithm A(n): A(n): { An/2); for i = 1 to n sum++; A(n/2);...
Given algorithm A(n): A(n): {for i = 1 ton sum++; A(n/2); } Fill in the appropriate expressions in the box provided: T(n) = TO ) + 03 Given algorithm A(n): A(n): { An/3); A(n/3) for i = 1 to n^2 sum++; A(n/3); } Fill in the appropriate expressions in the box provided: T(n) = TO ) + 问题4 Given algorithm A(n): A(n): { A(n/2); SOP ("Hello"); A(n/2); } Fill in the appropriate expressions in the box provided: T(n) = TO
Given algorithm A(n): A(n): { A(n/4); for i = 1 ton sum++; A(n/4); } Fill in the appropriate expressions in the box provided: T(n) = TO ) + 问题6 T(n) = 4 Tên/3) + n T(n) = "Theta" 2:57 T(n) = 2 Tn/2) + 1 T(n) = "Theta" 098 T(n) = T/n/2) + n T(n) = "Theta" 问题9 T(n) = 3 Tn2) + n T(n) = "Theta"
Induction proofs. a. Prove by induction: n sum i^3 = [n^2][(n+1)^2]/4 i=1 Note: sum is intended to be the summation symbol, and ^ means what follows is an exponent b. Prove by induction: n^2 - n is even for any n >= 1 10 points 6) Given: T(1) = 2 T(N) = T(N-1) + 3, N>1 What would the value of T(10) be? 7) For the problem above, is there a formula I could use that could directly calculate T(N)?...
3. Calculate the time complexity of the following algorithm: 1. Initialize sum to 0. I 2. Input the value of n. 3. While i = 0 to n-1 do a. sum=sumti; ; b. Increment i
(1) Give a formula for SUM{i} [i changes from i=a to i=n], where a is an integer between 1 and n. (2) Suppose Algorithm-1 does f(n) = n**2 + 4n steps in the worst case, and Algorithm-2 does g(n) = 29n + 3 steps in the worst case, for inputs of size n. For what input sizes is Algorithm-1 faster than Algorithm-2 (in the worst case)? (3) Prove or disprove: SUM{i**2} [where i changes from i=1 to i=n] ϵ tetha(n**2)....
Consider the following algorithm Poly(A,a) --------------- 1. n = degree of polynomial (with coef A[n],..,A[0]) 2. sum = 0 3. for i = n downto 0 4. sum = sum * a +A[i] show all steps!! (a) Determine the running time of the algorithm, your work should explain your answer (b) what is the loop invariant property of the loop in line 3.
Question 2 Consider the following algorithm Fun that takes array A and key Kas Fun(AO,...,n - 1], K) count = 0 for i = 0 ton - 1 do for j = i +1 to n - 1 do if A[i] + A[j] == K then count = count +1 end if end for end for return count What is the best case time complexity of the above algorithm?! (log(n)) O(1) (n) (na) Previous o H H 9
Consider the following recursive algorithm for computing the sum
of the first n cubes: S(n) = 13 +
23 + … + n3.
(a) Set up a recurrence relation for the number of
multiplications made by this algorithm.
(b) Provide an initial condition for the
recurrence relation you develop at the question (a).
(c) Solve the recurrence relation of the
question (a) and present the time complexity as described at the
question number 1.
Algorithm S n) Input: A positive...
Compare the algorithm below: Algorithm 1 for i= 0 to i = 4 get the num[i] sum = sum + num[i] Average = sum / 5 Print sum Print average Algorithm 2 for i= 0 to i = 4 get the num[i] for i= 0 to i = 4 sum = sum + num[i] Average = sum / 5 Print sum Print average Calculate the complexity of the algorithm. Choose the most efficient algorithm, explain your choice.
consider this segment of an algorithm: for i := 1 ton n for j:=1 to n top:=ij+j+10 a. find a function f(n) that counts the number of multiplication and additions performed in this segment. b. Give a big O estimate for the number of additions and multiplications used in the segment