You are viewing a single comment's thread. Return to all comments →
Java 8 Solution:
static SinglyLinkedListNode insertNodeAtHead(SinglyLinkedListNode llist, int data) { SinglyLinkedListNode newNode = new SinglyLinkedListNode(data); if(llist != null) newNode.next = llist; llist = newNode; return llist; }
Insert a node at the head of a linked list
You are viewing a single comment's thread. Return to all comments →
Java 8 Solution: