0% found this document useful (0 votes)
60 views31 pages

2021) Asymptotic Worst Case Time and Space Complexity

The document provides the scorecard and performance report for an algorithms topic test on asymptotic worst case time and space complexity. It shows that the test had 2043 students, 15 questions, and the candidate scored 13.68 marks out of 25 with a percentile of 54.58% and rank of 928th. The report provides question-wise and subject-wise analysis of the candidate's performance including correct, incorrect, unattempted questions and time taken on each question.

Uploaded by

Avinash Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views31 pages

2021) Asymptotic Worst Case Time and Space Complexity

The document provides the scorecard and performance report for an algorithms topic test on asymptotic worst case time and space complexity. It shows that the test had 2043 students, 15 questions, and the candidate scored 13.68 marks out of 25 with a percentile of 54.58% and rank of 928th. The report provides question-wise and subject-wise analysis of the candidate's performance including correct, incorrect, unattempted questions and time taken on each question.

Uploaded by

Avinash Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

3/23/2021 Download PDF

Exam Result of Algorithms Topic Test – 1(2021)Asymptotic worst


case time and space complexity

Score Card For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Total No. of 2043 My Marks 13.68 Correct 9 Incorrect 2


Student Question Question

Total Marks of 25.00 My Percentile 54.58% Right Marks 15.00 Negative 1.32
Test Marks

Total Question 15 Total Answered 11 Left 4 Left Question 6.00


in Test Question in Test Question Marks

Total Time of 1 My Time 31 Mins 49 My Rank 928th Result PASSED


Test Hours Sec

Performance Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity
Question & Marks Wise Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space
complexity
Subject Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Name Total Correct/ Marks Scored/ Unattempted


Questions Incorrect Negative Questions/
Question Marks Marks

Algorithms Topic Test – 15 9/2 15.00/1.32 4/6.00


1(2021)

Grand Total 15 9/2 15.00/1.32 4/6.00

Graphical Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity
Time Management For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Name Total Correct/ Marks Percentage Unattempted Total


Questions Incorrect Scored/ Questions/ Time
Question Negative Marks
Marks

Algorithms Topic Test 15 9/2 15.00/1.32 54.72% 4/6.00 31 Mins


– 1(2021) 48 Sec

Grand Total 15 9/2 15.00/1.32 54.72% 4/6.00 31 Mins


48 Sec

Question Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Q.No. Question Your Correct Max. Your Your Level


Answer Answer Marks Score Time

testseries.ravindrababuravula.com/crm/Results/printresult/126651 1/31
3/23/2021 Download PDF

1 Consider the following statements  g(n) is g(n) is O(h(n)) 1.00 1.00 2 Easy
O(h(n)) and and h(n) is Mins
S1: f(n) = n3 
h(n) is Ω(f(n)) 14
S2: g(n)= n2 logn Ω(f(n)) Sec

S3: h(n)= n! 

Which of the following statements is


represented asymptotically correct?

2  Follow the given conditions John=O(Alice) 1.00 1 Easy


and Mins
1. Bob can run 100 meters in a
Alice≠O(Bob) 26
maximum of 13 seconds. 
Sec
2. Alice can run 100 meters in a
maximum of 15 seconds.

1. John can run 100 meters in a


maximum of 14 seconds. 

Based on the given conditions which are


asymptotically correct?

3 Find the time complexity of a given O(n2)       1.00 48 Easy


recurrence relation using recursion tree Sec
method.

                   T(n)= T(n/4) + T(n/2) + n2

4 The time complexity of an algorithm T(n), O(logn) O(logn) 1.00 1.00 3 Easy
where n is input size is given by Mins
29
T(n)= T(n-1)+1/n, if n>1
Sec
      = 1, otherwise

The order of this algorithm is

testseries.ravindrababuravula.com/crm/Results/printresult/126651 2/31
3/23/2021 Download PDF

5  Consider the following function O(log2n) O(log2n) 1.00 1.00 1 Easy


Mins
59
Sec

What is the complexity for the above


given function?

6  Find the most appropriate matching for P-6, Q-1, R- P-6, Q-1, R-2, 2.00 2.00 1 Easy
the following pairs 2, S-3 S-3 Mins
43
Sec

7 Find the recurrence relation and its time 3T(n/2)+1 2T(n/2)+1 2.00 -0.66 5 Easy
complexity for given code segment and O(n2) and O(n) Mins
25
Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 3/31
3/23/2021 Download PDF

8 Find the worst-case time complexity for O(n6) O(n6) 2.00 2.00 49 Easy
given code segment Sec

9 Find the worst case time complexity of a O(n3) O(log2n) 2.00 -0.66 1 Easy
given algorithm? Mins
48
Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 4/31
3/23/2021 Download PDF

10 Find the time complexity of a given O(2n) O(2n) 2.00 2.00 1 Easy
recursion code segment is ___? Mins
42
Sec

11 What is the worst case time complexity of O(n3log2n) O(n3log2n) 2.00 2.00 1 Easy
below code segment Mins
40
Sec

12 State TRUE/FALSE for given statements S1-FALSE S1-FALSE 2.00 2.00 2 Easy
and S2- and S2- Mins
S1: 2T(n/2)-4T(n/2)+1 is solvable by using
FALSE FALSE 10
the master's theorem. 
Sec
S2: If for an algorithm time complexity is
given by O((3⁄2)n) then complexity will be
linear.

testseries.ravindrababuravula.com/crm/Results/printresult/126651 5/31
3/23/2021 Download PDF

13 Arrange the following functions in f4(n) > f1(n) f4(n) > f1(n) > 2.00 2.00 5 Easy
decreasing asymptotic order. > f3(n) > f3(n) > f5(n) > Mins
f5(n) > f2(n) f2(n) 34
Sec

14 1.77 2.00 7 Sec Easy

Flowchart for recursive function A(n):

testseries.ravindrababuravula.com/crm/Results/printresult/126651 6/31
3/23/2021 Download PDF

15 1 2.00 54 Easy
Sec

Solution For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Question: 1  
Consider the following statements 

S1: f(n) = n3 

S2: g(n)= n2 logn

S3: h(n)= n! 

Which of the following statements is represented asymptotically correct?

1.

f(n) is not O(h(n)) and g(n) is not O(h(n))

2.

f(n) is not O(h(n)) and h(n) is O(g(n))

3.

g(n) is O(h(n)) and f(n) is O(g(n))

4.

g(n) is O(h(n)) and h(n) is Ω(f(n))

Attempt Correct Correct Answer : Option4

Max Marks :  1.00 Marks Scored :  1.00 Time Taken :  2 Mins 14 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 7/31
3/23/2021 Download PDF

Solution :  
The asymptotic notations are following the given order.

Constant < logarithmic < linear < polynomial < exponential < factorial 

We can solve these type of problems by using three methods

1. Apply log on both sides 

2. Apply larger common mathematical value

3. Through asymptotic order.

The statements following asymptotic order are S2 < S1 < S3 . 

Option-A: FALSE: f(n)=O(h(n)) and g(n)=O(h(n)) because h(n) is asymptotically larger.

Option-B: FALSE: f(n)=O(h(n)) and h(n)≠O(g(n)) because g(n) is asymptotically smaller than h(n).

Option-C: FALSE: g(n)=O(h(n)) and f(n)≠O(g(n)) because f(n) is greater than g(n). So we can represent f(n)=O(h(n))
instead of f(n)=O(g(n))

Option-D: TRUE: g(n)=O(h(n)) and h(n)=Ω(f(n)) because g(n) is smaller than h(n) and f(n) is smaller than h(n).

Note: BigOh = Worst case (or) upper bound

          BigTheta= Average case

          BigOmega= Best case (or)  lower bound

Question: 2  
 Follow the given conditions

1. Bob can run 100 meters in a maximum of 13 seconds. 

2. Alice can run 100 meters in a maximum of 15 seconds.

1. John can run 100 meters in a maximum of 14 seconds. 

Based on the given conditions which are asymptotically correct?

1.

Bob=Ω(Alice) and Alice=O(John)

2.

Alice=O(John) and John≠O(Bob)

3.

John=O(Bob) and Bob=Ω(Alice)

4.

John=O(Alice) and Alice≠O(Bob)

Not Attempt Correct Answer : Option4

testseries.ravindrababuravula.com/crm/Results/printresult/126651 8/31
3/23/2021 Download PDF

Max Marks :  1.00 Marks Scored :   Time Taken :  1 Mins 26 Sec

Solution :  
According to given conditions Bob < John < Alice in terms of BigOh notations.

Option-A: FALSE: Bob=O(Alice) and Alice≠O(John) because Alice will take maximum time to reach 100 meters. 

Option-B: FALSE: Alice ≠ O(John) and John≠O(Bob) 

Option-C: FALSE: John ≠ O(Bob) and Bob=O(Alice)

Option-D: TRUE: John=O(Alice) and Alice≠O(Bob)

Question: 3  
Find the time complexity of a given recurrence relation using recursion tree method.

                   T(n)= T(n/4) + T(n/2) + n2

1.

O(n)

2.

O(nlogn)

3.

O(n2)      

4.

O(n2 logn)

Not Attempt Correct Answer : Option3

Max Marks :  1.00 Marks Scored :   Time Taken :  48 Sec

Solution :  

testseries.ravindrababuravula.com/crm/Results/printresult/126651 9/31
3/23/2021 Download PDF

Method-2: We can get time complexity by looking at recurrence relation because n2 is the leading term among
all. We can directly conclude time complexity is O(n2). 

Question: 4  
The time complexity of an algorithm T(n), where n is input size is given by

T(n)= T(n-1)+1/n, if n>1

      = 1, otherwise

The order of this algorithm is

testseries.ravindrababuravula.com/crm/Results/printresult/126651 10/31
3/23/2021 Download PDF

1.

O(logn)

2.

O(n)

3.

O(nlogn)

4.

O(1)

Attempt Correct Correct Answer : Option1

Max Marks :  1.00 Marks Scored :  1.00 Time Taken :  3 Mins 29 Sec

Solution :  
T(n) = T(n-1) + 1/n --- (I) 

T(n-1) = T(n-2) + 1/n-1 ---(II) 

T(n-2) = T(n-3) + 1/n-2 ---(III) 

Putting (II) in (I), 

T(n) = T(n-2) + 1/n-1 + 1/n ---(IV) 

Putting (III) in (IV), 

T(n) = T(n-3) + 1/n-2 + 1/n-1 + 1/n  

⋮ 

T(n) = T(n-k) + 1/n-(k+1) + … 1/n-2 + 1/n-1 + 1/n 

Base condition is, 

T(1) = 1 

So, n-k = 1 

      k = n-1 

So, T(n) = T(1) + 1/n-(n-1) + ½ + … + 1/n-1 + 1/n 

              = 1 + 1/1 + ½ + ⅓ + … + 1/n 

             = O(log n)

testseries.ravindrababuravula.com/crm/Results/printresult/126651 11/31
3/23/2021 Download PDF

Question: 5  
 Consider the following function

What is the complexity for the above given function?

1.

O(n)

2.

O(log2n)

3.

O(nlogn)

4.

O(loglog2n)

Attempt Correct Correct Answer : Option2

Max Marks :  1.00 Marks Scored :  1.00 Time Taken :  1 Mins 59 Sec

Solution :  

testseries.ravindrababuravula.com/crm/Results/printresult/126651 12/31
3/23/2021 Download PDF

Question: 6  
 Find the most appropriate matching for the following pairs

1.

P-4, Q-1, R-3, S-2

2.

P-6, Q-5, R-2, S-2

3.

P-4, Q-1, R-3, S-2

4.

P-6, Q-1, R-2, S-3

Attempt Correct Correct Answer : Option4

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  1 Mins 43 Sec

Solution :  

testseries.ravindrababuravula.com/crm/Results/printresult/126651 13/31
3/23/2021 Download PDF

testseries.ravindrababuravula.com/crm/Results/printresult/126651 14/31
3/23/2021 Download PDF

Question: 7  
Find the recurrence relation and its time complexity for given code segment

1.

2T(n/2)+1 and O(n)

2.

3T(n/2)+1 and O(n2)

3.

4T(n/2)+1 and O(logn)

4.

3T(n/2)+1 and O(n)

Attempt Incorrect Your Answers : Option2 Correct Answer : Option1

Max Marks :  2.00 Marks Scored :  -0.66 Time Taken :  5 Mins 25 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 15/31
3/23/2021 Download PDF

Solution :  
→ In recursion code segments we will consider only the recursion part to nd time complexity. We never
consider the dependent value of the recursion function. 

→ We will consider the recursion part in either “if” or “else” conditions. Both conditions will give the recurrence
relationship is Bob(n/2)+Bob(n/2)+1

We will not consider the dependent value of the else statement “3”.

→ We can rewrite the condition into T(n)=T(n/2)+T(n/2)+1

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

  Apply masters theorem,

a=2, b=2, k=0, p=0

Case-1: a>b^k

⇒ 2>2^0

O(n^log22 n)

O(n)

Question: 8  
Find the worst-case time complexity for given code segment

testseries.ravindrababuravula.com/crm/Results/printresult/126651 16/31
3/23/2021 Download PDF

1.

O(n6)

2.

O(n7)

3.

O(n4)

4.

O(n5)

Attempt Correct Correct Answer : Option1

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  49 Sec

Solution :  

testseries.ravindrababuravula.com/crm/Results/printresult/126651 17/31
3/23/2021 Download PDF

Question: 9  
Find the worst case time complexity of a given algorithm?

1.

O(log2n)

2.

O(log2n * log2log2n)

3.

O(n2 logn)

4.

O(n3)

Attempt Incorrect Your Answers : Option4 Correct Answer : Option1

Max Marks :  2.00 Marks Scored :  -0.66 Time Taken :  1 Mins 48 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 18/31
3/23/2021 Download PDF

Solution :  
if(1) condition is always TRUE and will never enter into “else” condition. 

testseries.ravindrababuravula.com/crm/Results/printresult/126651 19/31
3/23/2021 Download PDF

Question: 10  
Find the time complexity of a given recursion code segment is ___?

1.

O(log2n)

2.

O(2n)

3.

O(nlogn)

4.

None of the above

Attempt Correct Correct Answer : Option2

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  1 Mins 42 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 20/31
3/23/2021 Download PDF

Solution :  
The given code is nothing but the Tower of Hanoi.

testseries.ravindrababuravula.com/crm/Results/printresult/126651 21/31
3/23/2021 Download PDF

Question: 11  
What is the worst case time complexity of below code segment

1.

O(n3log2n)

2.

O(n3)

3.

O(n4)

4.

O(n2 log2n)

Attempt Correct Correct Answer : Option1

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  1 Mins 40 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 22/31
3/23/2021 Download PDF

Solution :  
→ The above code segment is a combination of iterative and recursion. Even though it is a combination of
iterative and recursion we have to nd worst case time complexity. 

→ The above code segment given two independent loops so we have to identify which is larger to nd worst case
time complexity.

Question: 12  
State TRUE/FALSE for given statements

S1: 2T(n/2)-4T(n/2)+1 is solvable by using the master's theorem. 

S2: If for an algorithm time complexity is given by O((3⁄2)n) then complexity will be linear.

testseries.ravindrababuravula.com/crm/Results/printresult/126651 23/31
3/23/2021 Download PDF

1.

S1-TRUE and S2-TRUE

2.

S1-FALSE and S2-FALSE

3.

S1-TRUE and S2-FALSE

4.

S1-FALSE and S2-TRUE

Attempt Correct Correct Answer : Option2

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  2 Mins 10 Sec

Solution :  
S1: FALSE: 2T(n/2)-4T(n/2)+1 is not solvable by using the master's theorem because masters theorem will allow
the recurrences in the form of aT(n/b)+f(n) or aT(n/b)+n^k log^p n. 

S2: FALSE: If for an algorithm time complexity is given by O((3⁄2)n) then complexity will be exponential.

The growth rate of O((3⁄2)n) or O(1.5)n function will be exponential therefore complexity will be exponential.

Question: 13  
Arrange the following functions in decreasing asymptotic order.

1.

f4(n) > f1(n) > f3(n) > f5(n) > f2(n)

2.

f4(n) > f3(n) > f1(n) > f5(n) > f2(n)

3.

f3(n) > f4(n) > f1(n) > f2(n) > f5(n)

4.

f3(n) > f4(n) > f1(n) > f5(n) > f2(n)

Attempt Correct Correct Answer : Option1

Max Marks :  2.00 Marks Scored :  2.00 Time Taken :  5 Mins 34 Sec

testseries.ravindrababuravula.com/crm/Results/printresult/126651 24/31
3/23/2021 Download PDF

Solution :  
We can solve this problem by 2 methods:

1. Apply log on both sides

2. Using asymptotic growth functions( constant, logarithmic, linear, polynomial and exponential)

In this problem, 2nd method is most suitable

            Constant < logarithmic < linear < polynomial < exponential

Step-1: 

testseries.ravindrababuravula.com/crm/Results/printresult/126651 25/31
3/23/2021 Download PDF

Question: 14  

Flowchart for recursive function A(n):

Not Attempt Correct Answer : 1.77

Max Marks :  2.00 Marks Scored :   Time Taken :  7 Sec

Solution :  
Explanation:

This type of problem, we have to consider worst case time complexity, it means that all possibilities.

According to the ow chart, there are a total 7 worst case possibilities of function calls.

Flowchart for recursive function A(n):

testseries.ravindrababuravula.com/crm/Results/printresult/126651 26/31
3/23/2021 Download PDF

The remaining function calls/return statements will execute only a constant amount of time.

So, the total function calls 7.

The Recurrence will be

A(n) = 7A(n/3) + O(1)

Apply Master’s theorem,

A=7, b=3, k=0, p=0

The remaining function calls/return statements will execute only a constant amount of time.

So, the total function calls 7.

The Recurrence will be

A(n) = 7A(n/3) + O(1)

Apply Master’s theorem,

A=7, b=3, k=0, p=0

testseries.ravindrababuravula.com/crm/Results/printresult/126651 27/31
3/23/2021 Download PDF

Question: 15  

Not Attempt Correct Answer : 1

Max Marks :  2.00 Marks Scored :   Time Taken :  54 Sec

Solution :  

ompare Report For Algorithms Topic Test – 1(2021)Asymptotic worst case time and space complexity

Total Ques. Total Score 13.68/25.00

testseries.ravindrababuravula.com/crm/Results/printresult/126651 28/31
3/23/2021 Download PDF

Maximum Marks 25.00 Percentage 54.72%

Attempted Ques. 11 Percentile 54.58%

Unattempted Ques. 4 Total Time 31 Mins 49 Sec

Correct Ques. 9 Rank

Incorrect Ques. 2 928th

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.95%

Unattempted Ques. 0 Total Time 29 Mins 9 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 1st


ayush33143314

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.90%

Unattempted Ques. 0 Total Time 22 Mins 51 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 2nd


guptaanshika.ag

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.85%

Unattempted Ques. 0 Total Time 57 Mins 25 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 3rd


bajpaiarjun0333

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.80%

testseries.ravindrababuravula.com/crm/Results/printresult/126651 29/31
3/23/2021 Download PDF

Unattempted Ques. 0 Total Time 22 Mins 54 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 4th


koradiyajayp

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.76%

Unattempted Ques. 0 Total Time 39 Mins 17 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 5th


kush.sharma2407

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.71%

Unattempted Ques. 0 Total Time 44 Mins 12 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 6th


Bhawna Jain

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.66%

Unattempted Ques. 0 Total Time 32 Mins 12 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 7th


Yash Chadaliya

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.61%

Unattempted Ques. 0 Total Time 37 Mins 12 Sec

Correct Ques. 15 Rank

testseries.ravindrababuravula.com/crm/Results/printresult/126651 30/31
3/23/2021 Download PDF

Incorrect Ques. 0 8th


pk819199

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.56%

Unattempted Ques. 0 Total Time 41 Mins 6 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 9th


vaipr10sh

Total Ques. 15 Total Score 25.00/25.00

Maximum Marks 25.00 Percentage 100.00%

Attempted Ques. 15 Percentile 99.51%

Unattempted Ques. 0 Total Time 50 Mins 35 Sec

Correct Ques. 15 Rank

Incorrect Ques. 0 10th


raghuwanshiy924

testseries.ravindrababuravula.com/crm/Results/printresult/126651 31/31

You might also like