Data Structures and Algorithms Design Week 1 NPTEL Assignment Answers 2025

NPTEL Data Structures and Algorithms Design Week 1 Assignment Answers 2025

1. You are given a sorted array from 1 to n, but one number is missing. What is a good way to find the missing number?

  • Use the expected sum and subtract actual sum
  • Sort the array again and scan
  • Guess the missing number
  • Randomly sample elements
Answer : For Answers Click Here 

2. In Merge Sort (ascending order), what is the order of elements after the second pass of merging for the array [20,28,11,2,3,1,27,25,8,17]

  • 2, 11, 20, 28, 1, 3, 25, 27, 8, 17
  • 2, 3, 11, 20, 28, 1, 8, 17, 25, 27
  • 11, 20, 28, 1, 2, 3, 8, 25, 27, 17
  • 1, 2, 3, 11, 20, 28, 8, 17, 25, 27
Answer :

3. Which algorithm of the following options uses the least number of comparisons (among the elements of the array) to sort the array A
in ascending order?

Where, A=[1,7,12,19,17,21,23].

  • Selection sort
  • Merge sort
  • Insertion sort
  • Quick sort
Answer :

4. Which of the following functions defines the Fibonacci sequence correctly?

  • F(n) = F(n) + F(n+1)
  • F(n) = F(n+1) + F(n+2)
  • F(n) = F(n-1) + F(n-2)
  • F(n) = F(n-1) – F(n-2)
Answer :

5. A sorting algorithm is called stable if it preserves the relative order of equal elements.

Which of the following is a stable sorting algorithm?

  • Insertion Sort
  • Quick Sort
  • Heap Sort
  • Selection Sort
Answer : For Answers Click Here 

6. Which of the following is the most appropriate use of an array?

  • Storing a fixed collection of elements where fast access is needed
  • Implementing hierarchical relationships
  • Representing nodes with multiple children
  • Storing elements with frequent insertions and deletions
Answer :

7. Why does repeated squaring help in computing the nth Fibonacci number faster?

  • Because matrix powers can be computed in logarithmic steps using exponentiation by squaring
  • Fibonacci numbers follow a geometric sequence
  • we can precompute all Fibonacci numbers and store them in an array
  • recursion eliminates redundant calculations automatically
Answer :

8. Suppose you are given a list of n integers and a target sum. In the brute-force approach to the Subset Sum problem, how many possible subsets need to be checked in the worst case?

  • 2n
  • n2
  • nâ‹…logn
  • n!
Answer :

9. Which of the following is not a disadvantage of using arrays as a data structure?

  • Arrays support constant-time access to any element using its index
  • Arrays have fixed size and cannot be resized without reconstruction
  • Inserting or deleting elements requires shifting multiple elements
  • Arrays cannot model data with varying-length records efficiently
Answer :

10. Binary Search is an example of which algorithmic design paradigm?

  • Divide and Conquer
  • Greedy
  • Dynamic Programming
  • Backtracking
Answer : For Answers Click Here