You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch this video explanation here : https://youtu.be/zwvWP4YmsoM
SinglyLinkedListNode* insertNodeAtTail(SinglyLinkedListNode* head, int data) { SinglyLinkedListNode* newNode = new SinglyLinkedListNode(data); if(head != nullptr) { SinglyLinkedListNode* curr = head; while(curr->next) curr = curr->next; curr->next = newNode; return head; } return newNode; }
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 →
Here is my c++ solution, you can watch this video explanation here : https://youtu.be/zwvWP4YmsoM