## NPTEL Problem Solving Through Programming in C Week 9 Assignment Answers 2024

1. What is the worst case complexity of selection sort?

a) O(nlogn)

b) O(logn)

c) O(n)

d) O(n^{2})

Answer :-For Answers Click Here

2. What is the correct order of insertion sort (in ascending order) of the array arr[5]={8 3 5 9 4}?

a) {3 8 5 9 4} -> {3 5 8 9 4} -> {3 4 5 8 9}

b) {3 8 5 9 4} -> {3 5 8 9 4} -> {3 5 8 4 9} -> {3 5 4 8 9} -> {3 4 5 8 9}

c) {3 8 5 9 4} -> {3 4 8 5 9} -> {3 4 5 8 9} -> {3 4 5 8 9}

d) {8 3 5 4 9} -> {8 3 4 5 9} -> {3 4 5 8 9}

Answer :-For Answers Click Here

3. When the Binary search is best applied to an array?

a) For very large size array

b) When the array is sorted

c) When the array elements are mixed data type

d) When the array is unsorted

Answer :-For Answers Click Here

4. Select the code snippet which performs unordered linear search iteratively?

Answer :-

5. What is the best case and worst case complexity of ordered linear search?

a) O(nlogn), O(logn)

b) O(logn), O(nlogn)

c) 0(n), 0(1)

d) 0(1), O(n)

Answer :-

6. Binary Search can be categorized into which of the following?

a) Brute Force technique

b) Divide and conquer

c) Greedy algorithm

d) Dynamic programming

Answer :-For Answers Click Here

7. Given an array at = {45, 77, 89, 91, 94, 98,100} and key = 100; what are the mid values (corresponding array elements) generated in the first and second iterations?

a) 91 and 98

b) 91 and 100

91 and 94

d) 94 and 98

Answer :-

8. Select the appropriate pseudo code that performs selection sort

Answer :-

9. Consider the array A[J= (5,4,9,1,3) apply the insertion sort to sort the array. Consider the cost sort ched wither render the dirt position 5 pes, what is the total cost of the insertion

a) 25

b) 50

c) 75

d) 100

Answer :-

10.

a) 5,4

b) 5,5

c) 4,4

d) 3,4

Answer :-For Answers Click Here