Skip to content

Instantly share code, notes, and snippets.

@prasath95
Created May 8, 2022 08:00
Show Gist options
  • Save prasath95/cf2b56192d607c2bba7e57ecf0b675dc to your computer and use it in GitHub Desktop.
Save prasath95/cf2b56192d607c2bba7e57ecf0b675dc to your computer and use it in GitHub Desktop.
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