Answer to Question #310217 in Algorithms for Rohu

Question #310217

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
Expert's answer
2022-03-12T04:56:00-0500

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


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS