Please answer both questions.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

Please answer both questions.

Using the master theorem, what is the solution to the recurrence relation T(1) =
(nlog(n))
(n²)
○ C. (n²log² (n))
d. ℗ (n²log³(n))
a.
O b.
○ e. ☺ (n³)
42, T (n)
=
n
4T (-) + n²log² (n) ?
Transcribed Image Text:Using the master theorem, what is the solution to the recurrence relation T(1) = (nlog(n)) (n²) ○ C. (n²log² (n)) d. ℗ (n²log³(n)) a. O b. ○ e. ☺ (n³) 42, T (n) = n 4T (-) + n²log² (n) ?
QUESTION 6
If L is a list of size n, what is the asymptotic run time of the following function?
function f(L)
if length(L) < 3
return L
A = []
B = []
for i from 0 to length(L)-1
if i%3 <= 1
A.append(3*L[i])
else
B.append(L[i])
return f(A) + f(B) #A concatenated with B
a. (n)
b.
C.
(nlog² (n))
log₂ (2),
(n
○ d. (n²)
e.
log(n))
Ⓒ (n
108 3/2 (2))
Transcribed Image Text:QUESTION 6 If L is a list of size n, what is the asymptotic run time of the following function? function f(L) if length(L) < 3 return L A = [] B = [] for i from 0 to length(L)-1 if i%3 <= 1 A.append(3*L[i]) else B.append(L[i]) return f(A) + f(B) #A concatenated with B a. (n) b. C. (nlog² (n)) log₂ (2), (n ○ d. (n²) e. log(n)) Ⓒ (n 108 3/2 (2))
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Threats
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning