Programming, Data Structures And Algo Using Python Assignment 7 Answers

Programming, Data Structures And Algo Using Python Assignment 7 Answers 2022:- In This article, we have provided the answers of Programming, Data Structures And Algo Using Python Assignment 7 You must submit your assignment to your own knowledge.

What is Programming Data Structures And Algorithms Using Python?

While hard skills teach us what to do, soft skills tell us how to apply our hard skills in a social environment. The focus of the course is to develop a wide variety of soft skills starting from communication, to working in different environments, developing emotional sensitivity, learning creative and critical decision making, developing awareness of how to work with and negotiate with people and to resolve stress and conflict in ourselves and others. 

The uniqueness of the course lies in how a wide range of relevant issues are raised, relevant skills discussed and tips for integration provided in order to make us effective in workplace and social environments.

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

Below you can find the answers for Programming Data Structures And Algo Using Python Assignment 7

Programming, Data Structures And Algo Using Python Assignment 7 Answers 2022:-

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.

Q1. Given the following permutation of a,b,c,d,e,f,g,h,i,j, what is the previous permutation in lexicographic (dictionary) order? Write your answer without any blank spaces between letters.

fjadchbegi

Answer:- fjadcgiheb

Q2. Assume we have defined a class Node that implements user defined lists of numbers. Each object node of type Node has two attributes node.value and node.next with the usual interpretation. We want to add a function sum() to the class Node which will compute the sum of values in the list. An incomplete implementation of sum() given below. What should be put in place of XXX and YYY?

def sum(self):
  if self.value == None:
    return(0)
  elif self.next == None:
    return(XXX)
  else:
    return(YYY)
  • Replace XXX by 1 and YYY by 1 + self.next.sum() 
  • Replace XXX by 1 and YYY by self.value + self.next.sum() 
  • Replace XXX by self.value and YYY by 1 + self.next.sum() 
  • Replace XXX by self.value and YYY by self.value + self.next.sum()

Answers:- d

Q3. Suppose we add this function foo() to the class Tree that implements search trees. For a name mytree with a value of type Tree, what would mytree.foo() compute?

def foo(self):
        if self.isempty():
            return(0)
        elif self.isleaf():
            return(self.value)
        else:
            return(self.value + max(self.left.foo(),
                                    self.right.foo()))
  • The sum of the elements in the tree 
  • The maximum sum across all root to leaf paths in the tree 
  • The length of the longest root to leaf path in the tree 
  • The number of root to leaf paths in the tree.

Answers:- b

Q4. The preorder traversal of a binary search tree with integer values produces the following sequence: 35, 23, 26, 46, 40, 39, 41, 52. What is the value of the right child of the root of the tree?

  • 39 
  • 40 
  • 41 
  • 46

Answers:- d

Disclaimer:- We do not claim 100% surety of solutions, these solutions are based on our sole expertise, and by using posting these answers we are simply looking to help students as a reference, so we urge to do your assignment on your own.

For More NPTEL Answers:- CLICK HERE

Join Our Telegram:- CLICK HERE

Programming, Data Structures And Algo Using Python Assignment 7 Answers 2022:- In This article, we have provided the answers of Programming, Data Structures And Algo Using Python Assignment 7 You must submit your assignment to your own knowledge.

Leave a Comment