Question: def insert_after(self, marker: Any, item: Any) -> None: Insert after the first time occurs in this linked list. Precondition: is in this linked list. >>>

 def insert_after(self, marker: Any, item: Any) -> None: "Insert after the

def insert_after(self, marker: Any, item: Any) -> None: "Insert after the first time occurs in this linked list. Precondition: is in this linked list. >>> Ist = LinkedList([1, 3, 2, 6]) >>> Ist.insert_after(3, 4) >>> # TODO: (Task 1) Fill in the 'expected' Linked List below. >>> # This should be in the format returned by _str_ >>> # e.g. '[1 -> 2 -> 3]' >>> expected = '[]' >>> >>> # TODO: (Task 2) Fill in the 'actual' LinkedList below. >>> # This should be the result of calling insert_after BEFORE >>> # you fixed the bug. >>> actual = '[]' >>> >>> # If you've done Task 1 and Task 3 correctly, the below should work: >>> str(Ist) == expected True # TODO: (Task 3) Fix the bug in insert_after. # Do NOT use any other Linked List methods # i.e. use only what we have provided in quiz5.py curr = self._first while curr.item != marker: curr = curr.next insert = _Node (item) curr.next = insert

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!