let a and b be two linked lists. write a c function to create a new linked list that contain elements alternately from A and B, beginning with the first element of A. If you run out of the elements in one of the lists, then append the remaining elements of the other list to C.
1 While there are elements in the lists A and B repeat steps 2 and 3
2 Get an element from list A and add it to the list C
3 Get an element from list B and add it to the list C
4 If there are elements in list A: add them to the end of list C
5 Else add rest of list B to the end of list C
Comments
Leave a comment