Created
May 8, 2022 08:00
-
-
Save prasath95/cf2b56192d607c2bba7e57ecf0b675dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 class LinkedList { | |
Node headNode; | |
/* | |
* insert method | |
* @value - integer | |
* */ | |
public void insert(int value){ | |
Node newNode=new Node(); | |
//3.1 | |
newNode.value=value;//params | |
//3.2 | |
if(headNode==null){ | |
headNode=newNode; | |
} | |
} | |
} | |
//for understanding i added Node Class below | |
public class Node { | |
int value; | |
Node nextNode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment