Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to write the following but I\'m stuck: _____________________________

ID: 3648458 • Letter: I

Question

I'm trying to write the following but I'm stuck:


__________________________________________________________________


Suppose two linked lists have been used to store a person's name and surname:


head1 -> "M" -> "a" -> "r" -> "k"

head2 -> "v" -> "a" -> "n "-> " " -> "A" -> "s"


Write code that will create a new linked list that will contain the name and the surname (in this order) contained in the two lists, separated by a space. This code should be in a main function.


__________________________________________________________________


Please read what I asked thoroughly before answering.

Explanation / Answer

Basically it is you want third link list that will have elements of 1st + 2nd list So for concatenating two link list you can use this... node *merge(node *a, node *b) { node *c = 0; while (a != 0) { c = insert(c, a->info); a = a->next; } while (b != 0) { c = insert(c, b->info); b = b->next; } return c; }