github

Made bySaurav Hathi

CSE - Practice Test -18

Q1:

What does it mean when we say that an algorithm X is asymptotically more efficient than Y?

Tags:
Section:
Algorithm
Options:
Q2:

The auxiliary space of insertion sort is O(1), what does O(1) mean ?

Tags:
Section:
Algorithm
Options:
Q3:

Which of the following is TRUE?

Tags:
Section:
Algorithm
Options:
Q4:

Consider a sorted array of n numbers. What would be the time complexity of the best known algorithm to find a pair a and b such that |a-b| = k , k being a positive integer.

Tags:
Section:
Algorithm
Options:
Q5:

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++;

}

Tags:
Section:
Algorithm
Options:
Q6:

Consider the following C program

int main()

{

int x, y, m, n;

scanf ("%d %d", &x, &y);

/* x > 0 and y > 0 */

m = x; n = y;

while (m != n)

{

if(m>n)

m = m - n;

else

n = n - m;

}

printf("%d", n);

}

What does the program compute?

Tags:
Section:
Algorithm
Options:
Q7:

Step(s) in Divide and conquer process that takes a recursive approach is said to be

Tags:
Section:
Algorithm
Options:
Q8:

The given array is arr = {2,6,1}. What are the pivots that are returned as a result of subsequent partitioning?

Tags:
Section:
Algorithm
Options:
Q9:

QuickSort can be categorized into which of the following?

Tags:
Section:
Algorithm
Options:
Q10:

An algorithm is a _________ set of precise instructions for performing computation.

Tags:
Section:
Algorithm
Options:
Q11:

The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is ______________.

Tags:
Section:
Algorithm
Options:
Q12:

What is the value of following recurrence?

T(n) = T(n/4) + T(n/2) + cn^2

T(1) = c

T(0) = 0

Where c is a positive constant

Tags:
Section:
Algorithm
Options:
Q13:

The complexity of Fibonacci series is

Tags:
Section:
Algorithm
Options:
Q14:

Which of the following is correct recurrence for worst case of Binary Search?

Tags:
Section:
Algorithm
Options:
Q15:

The time complexity of the following C function is (assume n > 0

int recursive (int n)

{

if (n == 1)

return (1);

else

return (recursive (n-1) + recursive (n-1));

}

Tags:
Section:
Algorithm
Options: