Created
June 19, 2022 02:33
-
-
Save wanderindev/c8fff4c060d946a216606143ef8c5d5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_after(self, node_data: Any, new_data: Any) -> None: | |
"""Add a node after the first node whose data is node_data""" | |
new_node = Node(new_data) | |
insert_at_node = self.get_node(node_data) | |
if insert_at_node: | |
new_node.next_node = insert_at_node.next_node | |
insert_at_node.next_node = new_node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment