Question

PROBLEM 1 (24 points): For each of the recursive functions below and on the next page, give a correct recurrence relation exp

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

1)

T(n) = 2T(1/2) + (nº)

using masters theorem

plog2² < n²

T(n) = P(n)

2)

T(n) = 2T(n^2) + (n)

n log22 =n

Tn) = (nlogn)

3)

T(n) = 2T(m - 1) + C - constant

by substitution method

T(n) = (27)

Add a comment
Know the answer?
Add Answer to:
PROBLEM 1 (24 points): For each of the recursive functions below and on the next page,...
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
  • Analyze the runtime of c functions below and give a tight runtime bound for each. ....

    Analyze the runtime of c functions below and give a tight runtime bound for each. . . Both functions have the same best-case and worst-case runtime (so this is not an issue). Since we want a "tight" runtime bound, your final answer should be in big-m form. Show your work! "The runtime of foo() is e(< something >)" is not sufficient even if <something> happens to be correct. In other words, convince the reader of the correctness of your answer....

  • 3. Recursive Program (6 points) Consider the following recursive function for n 1: Algorithm 1 int...

    3. Recursive Program (6 points) Consider the following recursive function for n 1: Algorithm 1 int recurseFunc(int n) If n 0, return 1. If n 1, return 1 while i< n do while j <n do print("hi") j 1 end while i i 1 end while int a recurse Func(n/9); int b recurse Func (n/9) int c recurse Func (n/9) return a b c (1) Set up a runtime recurrence for the runtime T n) of this algorithm. (2) Solve...

  • Need some help with finding the runtime of these java functions in the form of exact,...

    Need some help with finding the runtime of these java functions in the form of exact, tilde and big oh notation: Example of how: Func Exact Tilde O() Example 1 1 ~1 O(1) Example 2 2n+1 ~2n O(2n) Here are the functions: void funcA(int n) {         step();         for (int i = 0; i < n; i++) {             funcA(n-1);         }     }     void funcB(int n) {         step();         if (n > 0)             funcB(n-1);    ...

  • Strange Sort In a dumpster outside MEB, I found a scrap of paper with this Java...

    Strange Sort In a dumpster outside MEB, I found a scrap of paper with this Java implementation of a sorting algorithm on it: // This will get me the Turing Award for sure!! public static void sort (int[] A) { sort (A, O, A.length); // Sorts the subarray Allo .. hi-1] into ascending order private static void sort (int[] a, int lo, int hi) { int size = hi - lo; if (size == 2) { if (A[lo] > A[10+1])...

  • PROBLEM 4: Consider the recursive C++ function below: void foo(unsigned int n) {     if(n==0)        ...

    PROBLEM 4: Consider the recursive C++ function below: void foo(unsigned int n) {     if(n==0)         cout << "tick" << endl;     else {         foo(n-1);         foo(n-1);         foo(n-1);     } } 4.A: Complete the following table indicating how many “ticks” are printed for various parameters n. Unenforceable rule: derive your answers “by hand” -- not simply by writing a program calling the function. n number of ticks printed when foo(n) is called 0 1 2 3 4 4.B:...

  • 6. Using big-oh notation, give the runtime for each of the following recursive functions. You do...

    6. Using big-oh notation, give the runtime for each of the following recursive functions. You do not need to justify your answers: a) Int nonesense (int n) if (n <0) return 1; return nonsense (n-2) 1; b) int no nonesense (int n) if (n <0) return 1; return no_nonsense (n-1)+ no nonsense (n-1)

  • Hello, I would like to get help with the following algorithms and their respective analysis of...

    Hello, I would like to get help with the following algorithms and their respective analysis of runtime along with their recurrence equations, thanks in advance. 1.       Analyze each of the following algorithms by providing a tight big-Oh bound on the run time with respect to the value n. Create a recurrence equation. a.     void padawan(int n) {       if( n <= 10 )             time++;       else       {             for(int i=0; i<n; i++)                         time++;             padawan(n/3);             padawan(n/3);             padawan(n/3);       } } b.    void nerfHerder(int n)...

  • Three of these function overloads are considered identical by the compiler and would conflict with each...

    Three of these function overloads are considered identical by the compiler and would conflict with each other. The other would be considered different- choose the one that is considered different from others. Int foo ( int x, double y ) ; Int foo ( double x, int y ) ; Void foo ( int x, double y ) ; Int foo ( int day, double temp ) ; Consider the following incomplete code: Int f ( int number ) }...

  • 1(5 pts): For each code fragment below, give the complexity of the algorithm (O or Θ)....

    1(5 pts): For each code fragment below, give the complexity of the algorithm (O or Θ). Give the tightest possible upper bound as the input size variable increases. The input size variable in these questions is exclusively n. Complexity Code public static int recursiveFunction (int n)f f( n <= 0 ) return 0; return recursiveFunction (n - 1) 1; for(int i 0i <n; i+) j=0; for ( int j k=0; i; k < < j++) for (int j; m <...

  • The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access...

    The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access to a global list of distinct integers a_1, a_2,..., a_n. procedure search(i, j, x : i,j, x integers, 1 < i < j < n) if a_i = x then return i else if i = j then 4. return 0 else return search(i + 1, j, x) Prove that this algorithm correctly solves the searching problem when called with parameters i = 1...

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
ADVERTISEMENT