#Definition of Node class and other helper #functions to test your…
Question Answered step-by-step #Definition of Node class and other helper #functions to test your… Image transcription textQuestion 4 (12 points): Define a function that takes two parameters head and p. Assume that head is areference to the head node of a singly linked list and p is a positive integer. Also assume that data stored ineach node of the given linked list is a positive integer. Your function should return the number of n… Show more… Show more#Definition of Node class and other helper#functions to test your Question 4 solutionclass Node: def __init__(self, data): self.data = data self.next = Nonedef build_ll(glist): head = None i = 0 while i < len(glist): data = glist[i] new_node = Node(data) if head == None: head = new_node n1 = new_node else: n1.next = new_node n1 = new_node i = i + 1 return head Computer Science Engineering & Technology Python Programming CSC 214 Share QuestionEmailCopy link Comments (0)


