Nptel Programming Data Structures And Algorithms Using Python Week 1 Assignment Answer

ABOUT THE COURSE :
This course is an introduction to programming and problem solving in Python.  It does not assume any prior knowledge of programming.  Using some motivating examples, the course quickly builds up basic concepts such as conditionals, loops, functions, lists, strings and tuples.  It goes on to cover searching and sorting algorithms, dynamic programming and backtracking, as well as topics such as exception handling and using files.  As far as data structures are concerned, the course covers Python dictionaries as well as classes and objects for defining user defined datatypes such as linked lists and binary search trees.
INTENDED AUDIENCE: Students in any branch of mathematics/science/engineering, 1st year
PREREQUISITES: School level mathematics.
INDUSTRY SUPPORT: This course should be of value to any company requiring programming skills.

Nptel Programming Data Structures And Algorithms Using Python Week 1 Assignment Answer

Course layout

Week 1:
Informal introduction to programmin, algorithms and data structures viagcd
Downloading and installing Python
gcd in Python: variables, operations, control flow – assignments, condition-als, loops, functions

Week 2:
Python: types, expressions, strings, lists, tuples
Python memory model: names, mutable and immutable values
List operations: slices etc
Binary search
Inductive function denitions: numerical and structural induction
Elementary inductive sorting: selection and insertion sort
In-place sorting

Week 3:
Basic algorithmic analysis: input size, asymptotic complexity, O() notation
Arrays vs lists
Merge sort
Quicksort
Stable sorting

Week 4:
Dictionaries
More on Python functions: optional arguments, default values
Passing functions as arguments
Higher order functions on lists: map, lter, list comprehension

Week 5:
Exception handling
Basic input/output
Handling files
String processing

Week 6:
Backtracking: N Queens, recording all solutions
Scope in Python: local, global, nonlocal names
Nested functions
Data structures: stack, queue
Heaps

Week 7:
Abstract datatypes
Classes and objects in Python
“Linked” lists: find, insert, delete
Binary search trees: find, insert, delete
Height-balanced binary search trees

Week 8:
Effcient evaluation of recursive definitions: memoization
Dynamic programming: examples
Other programming languages: C and manual memory management
Other programming paradigms: functional programming

Nptel Programming Data Structures And Algorithms Using Python Week 1 Assignment Answer

Week 1 Quiz

Due date: 2025-02-05, 23:59 IST.
Assignment not submitted

All questions carry equal weightage. All Python code is assumed to be executed using Python3. You may submit as many times as you like within the deadline. Your final submission will be graded.Note:

  • If the question asks about a value of type string, remember to enclose your answer in single or double quotes.
  • If the question asks about a value of type list, remember to enclose your answer in square brackets and use commas to separate list items.

What is the value of f(8538) for the function below?

def f(x):
    d=0
    y=1
    while y <= x:
        d=d+1
        y=y*3
    return(d)
9
2.5 points

What is h(61)-h(60), given the definition of h below?

def h(n):
    s = 0
    for i in range(1,n+1):
        if n%i > 0:
           s = s+1
    return(s)
11

For what integer value n would g(87,n) return 12?

def g(m,n):
    res = 0
    while m >= n:
        res = res+1
        m = m-n
    return(res)
7
2.5 points

Consider the following function mys:

def mys(m):
    if m == 1:
        return(1)
    else:
        return(m*mys(m-1))

Which of the following is correct, assuming we always pass an integer argument to mys?

 
 
 
 

Related Posts