Insert a Node at the Tail of a Linked List

  • + 0 comments

    Hope this will helps you !! :)


    • var newNode = new SinglyLinkedListNode(data);
    • if(head == null){
    • head = newNode;
    • return head;
    • }else{
    • var temp = head;
    • while(temp.next!=null){
    • temp = temp.next;
    • }
    • temp.next = newNode;
    • return head
    • }*