
A list of lists of numbers is a list such that all its elements are lists of numbers.
Consider the following examples:
• [[3,5], [], [1, 1, 1]] is a list of list of numbers;
• [ [ [3,5]]], [], [1]] is not a list of list of numbers due to the first element;
• [2, [1]] is not a list of list of numbers due to the first element, but note that the tree that encodes this list also encodes [[0,0],[1]] which is a list of list of numbers.
Note that an empty list can always be considered a list of numbers and a list of lists of numbers.
Answer for EACH of the given trees (a)–(d) the following question:
Does it encode a list of numbers? If it does which is the corresponding list of numbers?
USE THE ENCODING OF DATATYPES IN D BELOW
(a) ((nil.nil).((nil. (nil.nil)).<<nil.(nil.nil)).nil)))
(b) (nil.((nil.nil).(({nil.(nil.nil)).nil).nil)))
(c) (((nil.nil).((nil. (nil.nil)).nil)).< (nil.(nil. (nil.nil ))).nil ))
(d) ((nil.nil).((nil.nil).<<<<nil.nil).nil).nil).nil)))

Step by stepSolved in 3 steps

- Determine the order of all elements of the multiplicative groups of: 1. Z*8 Z8 Create a list with two columns for every group, where each row contains an element and the order ord(a). Q3: Which elements in the previous question are primitive.arrow_forwarddef lastname_dict (names: List [List[str]]) -> Dict [str, List[str]]: """Given a list of [last-name, first-name] entries, return a dictionary mapping last-names to the list of first-names with that last-name. >>> lastname_dict([ ["Universe", "Steven"], ["Universe", "Greg"], \ ["Loot", "Mike"]]) {'Universe': ['Steven', 'Greg'], 'Loot': ['Mike']} ans = {} for last_name, first_name in names: if else: return ansarrow_forwardstruct insert_at_back_of_sll { // Function takes a constant Book as a parameter, inserts that book at the // back of a singly linked list, and returns nothing. void operator()(const Book& book) { /// TO-DO (3) /// // Write the lines of code to insert "book" at the back of "my_sll". Since // the SLL has no size() function and no tail pointer, you must walk the // list looking for the last node. // // HINT: Do not attempt to insert after "my_sll.end()". // ///// END-T0-DO (3) ||||// } std::forward_list& my_sll; };arrow_forward
- def reverse_list (1st: List [Any], start: int, end: int) -> None: """Reverse the order of the items in list , between the indexes and (including the item at the index). If start or end are out of the list bounds, then raise an IndexError. The function must be implemented **recursively**. >>> lst ['2', '2', 'v', 'e'] >>>reverse_list (lst, 0, 3) >>> lst ['e', 'v', 'i', '2'] >>> lst [] >>>reverse_list (lst, 0, 0) >>> lst [0] >>> Ist = [] >>> reverse_list (lst, 0, 1) Traceback (most recent call last): IndexError #1 #1arrow_forwardPythonarrow_forward• find_last(my_list, x): Takes two inputs: the first being a list and the second being any type. Returns the index of the last element of the list which is equal to the second input; if it cannot be found, returns None instead. >> find_last(['a', 'b', 'b', 'a'], 'b') 2 >>> ind = find_last(['a', 'b', 'b', 'a'], 'c') >>> print(ind) Nonearrow_forward
- A-1: Let l = [−1, −2, . . . , −10] be an existing list. Construct a new list from l by dividing each evennumber element in l by 2. Print the new list. Do not use NUMPY library.A-2: Create a new list containing the following elements using list comprehension:[1, −1, 2, −2, 3, −3, ..., 9, −9]A-3: Consider the following coded string. Create a list of all contiguous (connected without space) lettersin the order of their appearance."Vjg dguv rtqitcou ctg ytkvvgp uq vjcv eqorwvkpi ocejkpgu ecp rgthqto vjgoswkemn{0 Cnuq. vjg dguv rtqitcou ctg ytkvvgp uq vjcv jwocp dgkpiu ecp wpfgtuvcpfvjgo engctn{0 C iqqf guuc{kuv cpf c iqqf rtqitcoogt jcxg c nqv kp eqooqp0"A-4: In the list obtained after executing task(s) from Part(A-3), remove newline characters (if any).A-5: For the list obtained after executing task(s) from Part(A-4), for each word in the list do thefollowing: Breakdown the word into list of letters. Convert each of the above letters into integer, using ord() function. Update the…arrow_forwardWord frequencies (dictionaries) Implement the build_dictionary() function to build a word frequency dictionary from a list of words. Ex: If the words list is: ["hey", "hi", "Mark", "hi", "mark"] the dictionary returned from calling build_dictionary(words) is: {'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1} half answered: code: def build_dictionary(words):# The frequencies dictionary will be built with your code below.# Each key is a word string and the corresponding value is an integer # indicating that word's frequenc # The following code asks for input, splits the input into a word list, # calls build_dictionary(), and displays the contents sorted by key.if __name__ == '__main__':words = input().split()your_dictionary = build_dictionary(words)sorted_keys = sorted(your_dictionary.keys())for key in sorted_keys:print(key + ': ' + str(your_dictionary[key]))arrow_forwardCreate a function that takes two numbers as arguments (num, length) and returns a list of multiples of num until the list length reaches length. Examples list_of_multiples(7, 5) → [7, 14, 21, 28, 35] list_of_multiples(12, 10) → [12, 24, 36, 48, 60, 72, 84, 96, 108, 120] list_of_multiples(17, 6) [17, 34, 51, 68, 85, 102]arrow_forward
- def large_matrix(matrix: list[list[int]]) -> int:"""Returns the area of the rectangle in the area of a rectangle is defined by number of 1's that it contains.The matrix will only contain the integers 1 and 0.>>> case = [[1, 0, 1, 0, 0],... [1, 0, 1, 1, 1],... [1, 1, 1, 1, 1],... [1, 0, 0, 1, 0]]>>> largest_in_matrix(case1)6"" You must use this helper code: def large_position(matrix: list[list[int]], row: int, col: int) -> int: a = rowb = colmax = 0temp = 0rows = len(matrix)column = len(matrix[a])while a < rows and matrix[a][col] == 1:temp = 0while b < column and matrix[a][b] == 1:temp = temp + 1b = b + 1column = ba = a + 1if (a != row+1):temp2 = temp * (a - row)else:temp2 = tempif max < temp2:max = temp2b = colreturn max """ remember: Please do this on python you should not use any of the following: dictionaries or dictionary methods try-except break and continue statements recursion map / filter import""'arrow_forwardGiven an IntNode struct and the operating functions for a linked list, complete the following functions to extend the functionality of the linked list(this is not graded).arrow_forwarddef large_rec(m: list[list[int]], r: int, c: int) -> int:"""Do not use any imports, dictionaries, try-except statements or break and continue please you must make use of the helper long here as you loop througheach row of the matrix returns the area of the largest rectangle whose top left corner is atposition r, c in m.>>> case1 = [[1, 0, 1, 0, 0],... [1, 0, 1, 1, 1],... [1, 1, 1, 1, 1],... [1, 0, 0, 1, 0]]>>> largest_at_position(case1, 1, 2)6""" Helper code: def long(lst: list[int]) -> int: count = 0i = 0while i < len(lst) and lst[i] != 0:i = i + 1count = count + 1return countarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





