Created
May 2, 2020 13:16
-
-
Save Mahdhir/f8327898c22908e4b718d392471fb337 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
public void insertAfter(Node prev_node, int new_data) { | |
if (prev_node == null) { | |
System.out.println("The given previous node cannot be null"); | |
return; | |
} | |
Node new_node = new Node(new_data); | |
new_node.next = prev_node.next; | |
prev_node.next = new_node; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment