Computer Science EngineeringHardISRO SC (CS)
Using the Master theorem (extended form), the solution of T(n) = 2T(n/3) + n is:
- A. Theta(n log n)
- B. Theta(n log^2 n)
- C. Theta(n)
- D. Theta(n^(log_3 2))
Correct answer: C. Theta(n)
f(n) = n^1 dominates n^0.631 and the regularity condition holds, so T(n) = Theta(f(n)) = Theta(n). Here a = 2, b = 3, log_b a = 0.631.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- Consider the following C fragment. int c=0; for(int i=200;i>=1;i/=2) for(int j=0;j<i;j++) c++; What is c at the end? (integer division)
- The worst-case number of key comparisons binary search makes on a sorted array of 127 elements (counting one three-way comparison per…
- Consider the following C fragment. int c=0; for(int i=0;i<20;i++) for(int j=i+1;j<20;j++) for(int k=j+1;k<20;k++) c++; What is c at the end?
- Consider the following C fragment. int c=0; for(int i=0;i<10;i++) for(int j=i+1;j<10;j++) for(int k=j+1;k<10;k++) c++; What is c at the end?
- Consider the following C fragment. int c=0; for(int i=1;i<=30;i++) for(int j=i;j<=30;j+=i) c++; What is c at the end?
- The Levenshtein edit distance (insert, delete and substitute each cost 1) between "bddbccb" and "eedbaba" is: