Menu

(Solved) : Question 1 30 Points Following Source Code Incomplete Implementation Linked List Ll Use Im Q43987010 . . .

Question 1 : 30 points The following source code is an incomplete implementation of a linked list. Well use this implemen- t

Question 1 : 30 points The following source code is an incomplete implementation of a linked list. We’ll use this implemen- tation to answer some questions. Make your best guess about what the missing function definitions do. CON OF class Node: def __init__(self, val, next = None): self.–val = val self.–next = next def get Next (self): return self.–next def set Next (self ,n): self .–next = n def get Val(self): return self.–val def set Val (self,v: self.–val = v SEE 14 # insert new value at head of list 15 def makeNode(val, current Head): # TODO # return length of list def length (my List): # TODO # prints the list def toString (my List): p = my List res = while p != None: res += str (p.get Val() if p.getNext() != None: rest=”” p = p.getNext return res 33 # insert value at end of list def insert Tail (val, myList): # TODO 37 # if node in list, returns node 38 def find (target, haystack): # TODO # deletes node, returns new head of list after node deleted def delete (pointer, my List): # TODO Show transcribed image text Question 1 : 30 points The following source code is an incomplete implementation of a linked list. We’ll use this implemen- tation to answer some questions. Make your best guess about what the missing function definitions do. CON OF class Node: def __init__(self, val, next = None): self.–val = val self.–next = next def get Next (self): return self.–next def set Next (self ,n): self .–next = n def get Val(self): return self.–val def set Val (self,v: self.–val = v SEE 14 # insert new value at head of list 15 def makeNode(val, current Head): # TODO # return length of list def length (my List): # TODO # prints the list def toString (my List): p = my List res = while p != None: res += str (p.get Val() if p.getNext() != None: rest=”” p = p.getNext return res 33 # insert value at end of list def insert Tail (val, myList): # TODO 37 # if node in list, returns node 38 def find (target, haystack): # TODO # deletes node, returns new head of list after node deleted def delete (pointer, my List): # TODO

Expert Answer


Answer to Question 1 : 30 points The following source code is an incomplete implementation of a linked list. We’ll use this implem…

OR