Posts

Showing posts from September, 2020

15: Linked List(python)

                           Linked List Task Complete the  insert  function in your editor so that it creates a new  Node  (pass   as the  Node  constructor argument) and inserts it at the tail of the linked list referenced by the   parameter. Once the new node is added, return the reference to the   node. Note:  If the   argument passed to the  insert  function is  null , then the initial list is empty. Input Format The  insert  function has   parameters: a pointer to a  Node  named  , and an integer value,  . The constructor for  Node  has   parameter: an integer value for the   field. You  do not  need to read anything from stdin. Output Format Your  insert  function should return a reference to the   node of the linked list. Sol...

14: Scope(python)

                                 Scope(python) Task Complete the  Difference  class by writing the following: A class constructor that takes an array of integers as a parameter and saves it to the   instance variable. A  computeDifference  method that finds the maximum absolute difference between any   numbers in   and stores it in the   instance variable. Input Format You are not responsible for reading any input from stdin. The locked  Solution  class in your editor reads in   lines of input; the first line contains  , and the second line describes the   array. Constraints , where  Output Format You are not responsible for printing any output; the  Solution  class will print the value of the   instance variable. Solution: class  Difference:      def ...