Question 1

Time: 00:00:00
The worst-case complexity of quicksort is

O(n)

O(n)

O(log n)

O(log n)

O(n^2)

O(n^2)

O(n log n)

O(n log n)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

Time: 00:00:00
The complexity of merge sort is :

O(n)

O(n)

O(n logn)

O(n logn)

O(log n)

O(log n)

O(n^2)

O(n^2)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

Time: 00:00:00
The worst-case complexity for insertion sort is

O(n)

O(n)

O(log n)

O(log n)

O(nlogn)

O(nlogn)

O(n^2)

O(n^2)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
In data structure, time and space complexity by asymptotic notation. Which one of the following notation is not used to represent the same?

Big theta

Big theta

Big ohmega

Big ohmega

Big oh

Big oh

Big game

Big game

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
The worst-case occurs in quick sort when,

Pivot is the median of the array

Pivot is the median of the array

Pivot is the smallest element

Pivot is the smallest element

Pivot is the middle element

Pivot is the middle element

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

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

X will always be a better a better choice for large inputs

X will always be a better a better choice for large inputs

X will always be a better a better choice for smaller inputs

X will always be a better a better choice for smaller inputs

Y will always be a better a better choice for small inputs

Y will always be a better a better choice for small inputs

X will always be a better a better choice for all inputs

X will always be a better a better choice for all inputs

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
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();
}

O(N * M) time, O(1) space

O(N * M) time, O(1) space

O(N + M) time, O(N + M) space

O(N + M) time, O(N + M) space

O(N + M) time, O(1) space

O(N + M) time, O(1) space

O(N * M) time, O(N + M) space

O(N * M) time, O(N + M) space

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00
What is the time complexity of the following code:

int a = 0, i = N; 
while (i > 0)
{
a += i;
i /= 2;
}


O(N)

O(N)

O(Sqrt(N))

O(Sqrt(N))

O(N / 2)

O(N / 2)

O(log N)

O(log N)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
What is the time complexity of the 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;
}
}

O(n)

O(n)

O(nLogn)

O(nLogn)

O(n^2)

O(n^2)

O(n^2Logn)

O(n^2Logn)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
What is the time complexity of the following code:

int a = 0; 
for (i = 0; i < N; i++){
for (j = N; j > i; j--){
a = a + i + j;
}
}
}

O(N)

O(N)

O(N*log(N))

O(N*log(N))

O(N*log(N/2))

O(N*log(N/2))

O(N*N)

O(N*N)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments