Skip to content

Instantly share code, notes, and snippets.

@saiema
Created March 9, 2018 20:22
Show Gist options
  • Save saiema/3b4237e3818937e6457cfe42218139c5 to your computer and use it in GitHub Desktop.
Save saiema/3b4237e3818937e6457cfe42218139c5 to your computer and use it in GitHub Desktop.
public class List<T> {
private Node<T> header;
private int size;
public void insert(T e){
if (size == 0) header = new Node<T>(e);
else {
Node current = header;
while (current.next != null) {
current = current.next
}
Node<T> newNode = new Node<>(e);
current.next = newNode;
}
size++;
}
public T get(int i) {}
public int size() {}
public class Node<T> {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment