Looking for TT Module - VII test answers and solutions? Browse our comprehensive collection of verified answers for TT Module - VII at training.saveetha.in.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Consider the program
void function(int n) {
int i, j, count=0;
for (i=n/2; i <= n; i++)
for (j = 1; j <= n; j = j*2)
count++;}
The complexity of the program isWhat is the time complexity of following code:
int a = 0, i = N;
while (i > 0)
{
a += i;
i /= 2;
}
The complexity of Fibonacci series is
What is the time complexity of following code:
int a = 0;
for (i = 0; i < N; i++)
{
for (j = N; j > i; j--)
{
a = a + i + j;
}
}
What is the time complexity of the below function?
void fun(int n, int arr[]){ int i = 0, j = 0; for(; i < n; ++i) while(j < n && arr[i] < arr[j]) j++;}What is the time complexity of following code:
int a = 0, i = N;
while (i > 0)
{
a += i;
i /= 2;
}
What is the time complexity of following code:
int i, j, k = 0;
for (i = n / 2; i <= n; i++)
{
for (j = 2; j <= n; j = j * 2)
{
k = k + n / 2;
}
}
What is the time, space complexity of following code:
int a = 0, b = 0;
for (i = 0; i < N; i++)
{
a = a + rand();
}
for (j = 0; j < M; j++)
{
b = b + rand();
}
Give the correct matching for the following pairs:
A. O(log n) 1. Selection sort
B. O(n) 2. Insertion sort
C. O(nlog n) 3. Binary search
D. O(n^2) 4. Merge sort
codes:A B C D
a. 3 1 2 4
b. 3 1 4 2
c. 1 3 4 2
d. 1 4 3 2