Complexity in Data Structure

@T-Bone

This question paper focuses on the "Complexity" of Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This question paper focuses on the "Complexity" of Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. Which of the following case does not exist in complexity theory?

Mark the correct option

2. 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(); }

Mark the correct option

3. The complexity of linear search algorithm is

Mark the correct option

4. hat is the time complexity of following code: int a = 0; for (i = 0; i < N; i++) { for (j = N; j > i; j--) { a = a + i + j; } }

Mark the correct option

5. The Worst case occur in linear search algorithm when

Mark the correct option

6. What is the time complexity of 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; } }

Mark the correct option

7. The worst case occur in quick sort when

Mark the correct option

8. What does it mean when we say that an algorithm X is asymptotically more efficient than Y?

Mark the correct option

9. The complexity of Fibonacci series is

Mark the correct option

10. What is the time complexity of following code: int a = 0, i = N; while (i > 0) { a += i; i /= 2; }

Mark the correct option

11. What is the time complexity of following code: int a = 0, i = N; while (i > 0) { a += i; i /= 2; }

Mark the correct option

12. The complexity of Binary search algorithm is

Mark the correct option

13. The complexity of merge sort algorithm is

Mark the correct option

14. The complexity of Bubble sort algorithm is

Mark the correct option

15. The worst case complexity for insertion sort is

Mark the correct option

16. The worst case complexity of quick sort is

Mark the correct option

17. To measure Time complexity of an algorithm Big O notation is used which:

Mark the correct option

18. If for an algorithm time complexity is given by O(1) then complexityof it is:

Mark the correct option

19. If for an algorithm time complexity is given by O(log2n) then complexity will:

Mark the correct option

20. If for an algorithm time complexity is given by O(n) then complexityof it is:

Mark the correct option

21. if for an algorithm time complexity is given by O(n2) then complexity will:

Mark the correct option

22. If for an algorithm time complexity is given by O((3/2)^n) then complexity will:

Mark the correct option

23. the time complexity of binary search is given by:

Mark the correct option

24. The time complexity of linear search is given by:

Mark the correct option

25. Which algorithm is better for sorting between bubble sort and quicksort?

Mark the correct option

26. State true or false Time complexity of binary search algorithm is constant

Mark the correct option

27. Two main measures for the efficiency of an algorithm are

Mark the correct option

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

Mark the correct option

29. Which algorithm is having highest space complexity?

Mark the correct option

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

Mark the correct option