Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Question Bank for GATE Computer Science Engineering  >  Test: Algorithm Analysis & Asymptotic Notation- 2 - Computer Science Engineering (CSE) MCQ

Test: Algorithm Analysis & Asymptotic Notation- 2 - Computer Science Engineering (CSE) MCQ


Test Description

15 Questions MCQ Test Question Bank for GATE Computer Science Engineering - Test: Algorithm Analysis & Asymptotic Notation- 2

Test: Algorithm Analysis & Asymptotic Notation- 2 for Computer Science Engineering (CSE) 2024 is part of Question Bank for GATE Computer Science Engineering preparation. The Test: Algorithm Analysis & Asymptotic Notation- 2 questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Algorithm Analysis & Asymptotic Notation- 2 MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Algorithm Analysis & Asymptotic Notation- 2 below.
Solutions of Test: Algorithm Analysis & Asymptotic Notation- 2 questions in English are available as part of our Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) & Test: Algorithm Analysis & Asymptotic Notation- 2 solutions in Hindi for Question Bank for GATE Computer Science Engineering course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Algorithm Analysis & Asymptotic Notation- 2 | 15 questions in 45 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 1

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 1

The notation Ω(n) is the formal way to express the lower bound of an algorithm's running time. It measures the best case time complexity or the best amount of time an algorithm can possibly take to complete.

The notation O(n) is the formal way to express the upper bound of an algorithm's running time. It measures the worstcase time complexity of the algorithms.

 

Let's analyze the functions and their growth rates to determine which of the statements is true.

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 2

Look at the following algorithms
int n;
int A[100];
void (x){

int i;
for (i=n/2;i > = 1; i -- )
y(i);
}
}
void  y(int i)
{
.........;
.........;
.........;
}
Let complexity of y is O(log2n). Then the complexity of x will be

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 2

In this programme for loop run n/2 times and in this ‘for loop’ y(i) have (log2 n) time complexity. In the above we will select maximum time complexity i.e., (n/2) log2n.
Then the total time complexity for the ‘for loop’ will O(n logn).

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 3

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));
}

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 3

The given C function is recursive. The best way to find the time complexity of recursive function is that convert the code (algorithm) into recursion equation and solution of the recursion equation is the time complexity of given algorithm.

1. int recursive (int i){
2 . if ( n == 1) return (1);
3. else
4. return (recursive(n-1) + recursive(n-1));
5. }
Let recursive(n) - T(n)
According to line 2 if (n = = 1) return(1) then the recursive equation is
T(n) = 1, n = 1
According to line 4 the recursion equation is
T(n) = T ( n - 1 ) + T(n-1), n > 1
So the complete recursion equation is 

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 4

 The recurrence equation:

Evaluates to

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 4

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 5

 Let T(n) be a function defined by the recurrence

T(n) - 2T(n/2) + √n for n≥2 and T(1)  = 1

Which of the following statements is TRUE?

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 5

By substitution method

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 6

Suppose T(n) = 2T(n/2) + n, T(0) = T(1) = 1 Which one of the following is FALSE?

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 6

T(0)= T(1) = 1 
T(n) = 2T(n/2) + n
T(n) be computed as follows:

[T(n) can also proved by Master Theorem]
if  then it is also 0(n logn) and O(n2) but it is not Ω(n2).

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 7

Consider the following segment of C code

The number of comparisons made in the execution of the loop for any n > 0 is

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 7

Let the increment of j is 2°, 21...., 2i for some value of i so according to the question for while loop: 

One extra comparison required for the termination of while loop. So total number of comparisons 

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 8

What is the time complexity of the following recursive function: 
int DoSomething ( int n)
{
if {n< = 2)
return 1;
else
return DoSomething (floor (sqrt (n)))+n;
}

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 8

The given function is recursive so the equivalent recursion equation is

All the level sums are equal to n. The problem size at level k of the recursion tree is n2-k and we stop recursing when this value is a constant. Setting n2-k = 2 and solving for k gives us  

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 9

 Using the standard algorithm, what is the time required to determine that a number n is prime?

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 9

It takes not more than n/2 comparison to check whether the given number n is prime or not.

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 10

The running time of an algorithm T(n), where ‘n’ is the input size is given by

T(n) = 8T(n/2) + qn. if n> 1
p, if n = 1

where p, q are constants. The order of this algorithm is

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 10

Since q is constant, so our recurrence relation look like

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 11

 Let m, n be positive integers. Define Q(m, n) as

Then Q(m, 3) is (a div b, gives the quotient when a is divided by b)

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 11

Two cases: Q(m, 3)
(i) m ≥ n : here m ≥ 3 
For

∵ Since 3 is divide by 3 only 1 time = 0 + P= P.
So this recursive program generate P, m/n times until m < n.
So, Q(m, 3) = Px(m div 3)

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 12

T(n) = T(2n/3) + 1 then T(n) is equal to 

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 12

By using recursive tree method:

So, height of tree is log(3/2)n
So, T(n) = Height x Work at each level.

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 13

An algorithm is made up of 2 m odules m1 and m2. If order of M1 is f(n) and M2 is g(n) then the order of the algorithm is

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 13

So, order of algorithm
 

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 14

The recurrence relation T(n) = mT(n/2) + an2 is satisfied by

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 14

T(n) = mT (n/2) + an2
Since,
m ≥ 5 
So by applying Master Theorem:

Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 15

The running time T(n) where ‘n' is the input size of a recursive algorithm is given as follow

The order of this algorithm is 

Detailed Solution for Test: Algorithm Analysis & Asymptotic Notation- 2 - Question 15


63 videos|8 docs|165 tests
Information about Test: Algorithm Analysis & Asymptotic Notation- 2 Page
In this test you can find the Exam questions for Test: Algorithm Analysis & Asymptotic Notation- 2 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Algorithm Analysis & Asymptotic Notation- 2, EduRev gives you an ample number of Online tests for practice

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)