Programming, Data Structures And Algorithms Using Python

Week 7 Quiz

Due date: 2019-09-18, 23:59 IST.
Your last recorded submission was on 2019-09-11, 15:58 IST
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.
Given the following permutation of a,b,c,d,e,f,g,h,i,j, what is the next permutation in lexicographic (dictionary) order? Write your answer without any blank spaces between letters.
    eibjdhgfca
    [e,i,b,j,f,a,c,d,g,h]
2.5 points
2.5 points
We want to add a function listmax() to the class Node that implements user defined lists such that listmax() computes the maximum value in a list where values are of type int.
An incomplete implementation of listmax() given below. You have to provide expressions to put in place of AAABBB and CCC.
    
     def listmax(self):
        if self.value == None:
            return(AAA)
        elif self.next == None:
            return(BBB)
        else:
            return(CCC)
 
 
 
 
2.5 points
Suppose we add this function foo() to the class Tree that implements search trees. For a name mytreewith a value of type Tree, what would mytree.foo() compute?
    def foo(self):
        if self.isempty():
            return(0)
        elif self.isleaf():
            return(1)
        else:
            return(self.left.foo() + self.right.foo()))
 
 
 
 
Inorder traversal of a binary tree has been defined in the lectures. A postorder traversal lists the vertices of a binary tree (not necessarily a search tree) as follows:
  • Print the left subtree in postorder.
  • Print the right subtree in postorder.
  • Print the root. 
Suppose we have a binary tree with 10 nodes labelled a, b, c, d, e, f, g, h, i, j, with postorder traversal ehicbjfadg and inorder traversal ehbicgjafd. What is the left child of the root node?
  [b]

6 comments

  1. THANKYOU SOO MUCH!!! MGBU! PLEASE UPLOAD WEEK 8 AS WELL AND ALSO PLEASE TRY UPLOADING ANSWERS FOR HASKELL PROGRAMMING COURSE.

    ReplyDelete
  2. Sir please upload week 8 programming assignment solution..

    ReplyDelete
  3. Appreciate on very helpful sharing. Codemic is a YouTube channel with videos on gaming, programming, and vintage tech enthusiast. I make all sort of fun videos on just about everything that comes to mind. Why don't you stay awhile?

    ReplyDelete
  4. Genome valley lab spaces
    Genome Valley Lab Spaces - Genome Valley, spread over 25 sq kms in the vicinity of Lab Space Hyderabad, is India's first organized R&D cluster, world-class

    ReplyDelete
  5. I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!. https://python.engineering/algorithms-in-c/

    ReplyDelete

File Uploading in PHP

  File Uploading in PHP PHP allow you to upload any type of a file i.e. image, binary or text files.etc..,PHP has one in built global variab...