Question: C++ help! Write a function merge that merges two lists into one, alternating ele- ments from each list until the end of one of the
C++ help! Write a function merge that merges two lists into one, alternating ele- ments from each list until the end of one of the lists has been reached, then append- ing the remaining elements of the other list. For example, merging the lists containing A B C and D E F G H should yield the list A D B E C F G H. However, do not create a third list; insert values of the second list into the first list. Your function should not fail when one (or both) of the lists is (are) empty. Write and test your merge function in a main function.
Please help. Thanks a ton!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
