Appending a Linked List to Another

[wpdm_package id=’1177′]

Appending a linked list onto another is pretty easy. All you have to do is, make the last node’s next pointer of the first list to point to the head of the second list, as shown. But in the upcoming posts, we can find more advanced changes like, returning a sorted list after appending a sorted list to another sorted list, and so on.

[sourcecode lang=”cpp”]

void append_list(intnode * head1) {
intnode* temp;


Leave a Reply

Your email address will not be published. Required fields are marked *