SingleLinkedList
-
LinkedListAlgorithm 2020. 8. 31. 16:36
public class Node { public T data; public Node next; public Node(T data) { this.data = data; this.next = null; } } public class MySingleLinkedList { public Node head = null; public int size = 0; public MySingleLinkedList() {} public void addFirst(T item) { Node newNode = new Node(item); newNode.next = head; head = newNode; size++; } public void addAfter(Node before, T item) { Node newNode = new ..