Answers for "inserting item after another item linked list python"

0

inserting item after another item linked list python

def insert_after_item(self, x, data):

        n = self.start_node
        print(n.ref)
        while n is not None:
            if n.item == x:
                break
            n = n.ref
        if n is None:
            print("item not in the list")
        else:
            new_node = Node(data)
            new_node.ref = n.ref
            n.ref = new_node
Posted by: Guest on June-03-2021

Code answers related to "inserting item after another item linked list python"

Python Answers by Framework

Browse Popular Code Answers by Language