You are viewing a single comment's thread. Return to all comments →
You are not alone! Here is mine:
def CompareLists(headA, headB): if headA is None or headB is None: return 0 else: nodeA = headA nodeB = headB flag = 0 while nodeA is not None and nodeB is not None: if nodeA.data != nodeB.data: flag = 2 nodeA= nodeA.next nodeB=nodeB.next if flag == 2: return 0 else: if nodeA is None and nodeB is not None: return 0 elif nodeB is None and nodeA is not None: return 0 else: return 1
Seems like cookies are disabled on this browser, please enable them to open this website
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →
You are not alone! Here is mine: