Question
Q1) A. Prove or disprove (2 Pts.) If f(n) is O(g(n)). Is then 2 f(n) = O(2 g(n) )? f(n) = O(g(n)), then g(n) =
Q1)
A. Prove or disprove (2 Pts.)
-
If f(n) is O(g(n)). Is then 2f(n) = O(2 g(n))?
-
f(n) = O(g(n)), then g(n) = O(f(n)).
-
nk = (2n)
-
log(n!) = (nlogn)
B) In each of the following situations, indicate whether f = O(g), or f = (g),
or both f = (g). (2 Pts.)
-
f(n) = 100n + log n and g(n) = n + (log n)2.
-
f(n) = n1.01 and g(n) = n log n.
-
f(n) = n1/2 and g(n) = 4log n
-
f(n) = 2n and g(n) = 2n+1.
Q2.
A. Find the time recurrence equation and the complexity (2 pts.)
1.
int Fun1(int n)
{
if (n <= 0)
return 1;
for (int i=0;i constOperation; return 1 + Fun1(n-1); } 2. int Fun2(int n) { if (n <= 0) return 1; for (int i=0;i for(int j=0;j<=i;j++) constOperation; return 1 * Fun3(n/2); } B) Write D&C algorithm to search about an item K in a list. (2 Pts.) Q3) what is the P, NP, NP-hard and NP-complete? (1 Pts.) What are the steps of converting the hard problem into NP-Complete? (1 pts.)
Step 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