Question: Write C++ code for the following: Given two pointer variables (say p and q), that point to two different NULL-terminated singly-linked lists, create a new

 Write C++ code for the following: Given two pointer variables (say

Write C++ code for the following: Given two pointer variables (say p and q), that point to two different NULL-terminated singly-linked lists, create a new list (pointed to by p) which results from inserting all the elements in the list pointed to by q into the list pointed to by p, just after the first node (the node pointed to by p). You should be able to do this by simply adjusting pointers. As part of your solution, include "before" and "after" pictures using box and arrow notation. (It would be wise to draw these before you write the code.) You may assume that both lists contain at least one node. (10 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!