Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started