Question: 6. (2 pts) Write an algorithm for the implementation of the method contains(x) of the DLList data structure below. The method should return True
6. (2 pts) Write an algorithm for the implementation of the method contains(x) of the DLList data structure below. The method should return True if the list contains the value x, or False otherwise. 1 from Interfaces import List 2 3 4 class DLList(List): s class Node: def __init__(self,x: object): 7 self.x = x & self.next = None > self.prev = None 10 11 def __init__(self): 12 self.dummy = DLList.Node(None) 13 self.dummy.next = dummy 14 self.dummy.prev= dummy 15 self.n = 0 16 return 17 18 def contains(self,x: object): 19 # todo 20 return
Step by Step Solution
3.38 Rating (160 Votes )
There are 3 Steps involved in it
from Interfaces import List class DLListList class Node def init... View full answer
Get step-by-step solutions from verified subject matter experts
