Question: Please using C ++ code Present a function to merge two linked lists and produce one list. Given two lists, your function must merge them

Please using C ++ code
Present a function to merge two linked lists and produce one list. Given two lists, your function must merge them is such a way that it interleaves one element from each list alternatively to produce the final list. For example, consider a list such as 1 rightarrow 2 rightarrow 3 rightarrow 4 rightarrow 12 rightarrow 19 rightarrow NULL with a pointer "firstList" pointing to its first element (1), and another list such as 8 rightarrow 7 rightarrow 6 rightarrow 5 rightarrow NULL with a pointer "secondList" pointing to its first element (8) your function produces 1 rightarrow 3 rightarrow 6 rightarrow 4 rightarrow 5 rightarrow rightarrow12 rightarrow19 rightarrow NULL, with the "first Pointer" pointing to the first element of this new list (1). The idea is to now merge both lists by taking one element from each at any time; in case you exhaust one list, you simply append elements from the other list until you have considered all elements. In other words, implement void mergeLinkedList (chunk *firstList, chunk* secondList)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
