You are viewing a single comment's thread. Return to all comments →
Javascript
function insertNodeAtTail(head, data) { if(head === null) { return { data, next: null } } let node = head; while(node !== null) { if(node.next === null) { node.next = { data, next: null }; break; } node = node.next; } return head; }
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a Node at the Tail of a Linked List
You are viewing a single comment's thread. Return to all comments →
Javascript