Data Structures :: Complexity

Home > Data Structures > Complexity > General Questions

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

1 / 14

 The complexity of searching an element from a set of n elements using Binary search algorithm is

AO(n)

BO(log n)

CO(n^2)

DO(n log n)

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

2 / 14

 Two main measures for the efficiency of an algorithm are

ATime and space

BProcessor and memory

CComplexity and capacity

DData and space

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

3 / 14

 If the array is already sorted, then the running time for merge sort is: ?

AO(1)

BO(n*log n)

CO(n)

DO(n^2)

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

4 / 14

 Which is the best data structure for round robin algorithm for CPU scheduling?

AStack implemented using queues

BDoubly linked list

CCircular queue

DQueue implemented using stacks

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

5 / 14

 Which algorithm is having highest space complexity?

ABubble sort

BInsertion Sort

CQuick Sort

DMerge Sort

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

6 / 14

 quicksort algorithm is used to sort an array of N elements. If all the N values w
complexity of quicksort that uses first element as the pivot. ?

AO(N*N)

BO(1)

CO(N)

DO(N log N)

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

7 / 14

 Algorithms A and B solve the same problem. Time complexity of A is in O(n^2) and that of B is in O(n). Which among the following can you guarantee?

AA is having less executable instructions than B

BA is having more number of functions than B

CA is having less number of functions than B

DA is having more executable instructions than B

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

8 / 14

 The complexity of merge sort algorithm is

AO(n)

BO(log n)

CO(n2)

DO(n log n)

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

9 / 14

 The complexity of linear search algorithm is

AO(n)

BO(log n)

CO(n2)

DO(n log n)

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
0
Solv. In. Corr.
0
Attempted
0 M:0 S
Avg. Time

10 / 14

 The complexity of Binary search algorithm is

AO(n)

BO(log )

CO(n2)

DO(n log n)

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace