Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Redefine the addition operation of LinkList to create a new LinkList as following: L3=L1 + L2 where L1, L2 and L3 are same

imageimage

(a) Redefine the addition operation of LinkList to create a new LinkList as following: L3=L1 + L2 where L1, L2 and L3 are same class LinkList. e.g. if L1 = 1->2 and L2 = 5->8, then L3 will be 1->2->5->8 Provide 3 more testing cases for this question. Exceptional cases should be considered. (b) Redefine the comparing operation of two LinkList such that if all element inside the list and their order are consistence, it will return True. Otherwise, return False. L1=L2 e.g. if L1 = 1->2 and L2 = 1->2, then it will return true. If L1 =1->2 and L2 = 2->1, then it will return false. Provide 3 more testing cases for this question. Exception cases should be considered. class Linked List: def __init__(self): self.head = None self.tail = None def display (self): current_node = self.head while current_node: print(current_node.data, end=" ") current_node = current_node.next print() def append(self, node): if self.head is None: self.head node self.tail = node else: self.tail.next = node self.tail = node

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Cross Cultural Management

Authors: Marie Joelle Browaeys, Roger Price

3rd Edition

1292015896, 978-1292015897

More Books

Students also viewed these Programming questions