Question on Big O Notation Quiz-1

Question 1

Time: 00:00:00
What is the Big-O notation for the below algorithm given below?

l. N^2

ll.10*N^2+N

 

O(N) and O(log N^2)

O(N) and O(log N^2)

O(N^2) and O(N^2)

O(N^2) and O(N^2)

O(N) and O(N^2)

O(N) and O(N^2)

O(N^2) and O(N)

O(N^2) and O(N)

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

Please login to submit your explanation

Question 2

Time: 00:00:00
What is the big-O complexity of the following code?

for{int i=n ;  i>0   ;   i--}

{

for{ int   j = i;   j  <  n;  j   *=  2}

{

for{ int  k = 0;  k  <  j;  k++}

{

.....

}

}

}

 

O(log n)

O(log n)

O(n ^ 2)

O(n ^ 2)

O(n ^ 3)

O(n ^ 3)

O(n)

O(n)

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

Please login to submit your explanation

Question 3

Time: 00:00:00
What is the best suited Big O notation for merge sorting?

 

O(n)

O(n)

O(n^2)

O(n^2)

O(n log n)

O(n log n)

O(log n)

O(log n)

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

Please login to submit your explanation

Question 4

Time: 00:00:00
The worst case time complexity of native version quicksort is_____.

O(n log n)

O(n log n)

O(2^n)

O(2^n)

O(n^2)

O(n^2)

O(n)

O(n)

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

Please login to submit your explanation

Question 5

Time: 00:00:00
What is the big-o-notation to find the nth item in a list?

O(n)

O(n)

O(n!)

O(n!)

O(n^c)

O(n^c)

O(log n )

O(log n )

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

Please login to submit your explanation

Question 6

Time: 00:00:00
Consider the following :

for (int n = 0; n<100; n++)

{

for(int m = 0; m<=n; m++)

{

// search 4th element using binary search

}

}

What is the Big-O Complexity of the above code?

O(100*m*n*log N)

O(100*m*n*log N)

100*m*n*O(log N)

100*m*n*O(log N)

O(100 m log N)

O(100 m log N)

100m*O(log N)

100m*O(log N)

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

Please login to submit your explanation

Question 7

Time: 00:00:00
Express the formula (n-1)*(n-5) in terms of big O notation

O(1)

O(1)

O(log n)

O(log n)

O(n)

O(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 8

Time: 00:00:00
The worst-case time complexity of Selection Exchange Sort is________.

O(n^2)

O(n^2)

O(log n)

O(log n)

O(n)

O(n)

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 9

Time: 00:00:00
A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is

O (n log n)

O (n log n)

O (n^2 log n)

O (n^2 log n)

O (n^2 + log n)

O (n^2 + 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 10

Time: 00:00:00
The total number of comparisons made in quicksort for sorting a file of size n is

O(n log n)

O(n log n)

O(n2)

O(n2)

O(log n)

O(log n)

None of the above

None of the above

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! \n","Keep trying! \n","Not bad! \n","Good work! \n","Perfect! \n"]

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