401 data structures and algorithms code challenges
Zip two linked lists.
Write the following method for the Linked List class:
zipLists(list1, list2)
Arg list1 |
Arg list2 |
Output |
---|---|---|
[1] -> [3] -> [2] -> null | [5] -> [9] -> [4] -> null | [1] -> [5] -> [3] -> [9] -> [2] -> [4] -> null |
[1] -> [3] -> null [5] -> [9] -> [4] -> null | [1] -> [5] -> [3] -> [9] -> [4] -> null | |
[1] -> [3] -> [2] -> null [5] -> [9] -> null | [1] -> [5] -> [3] -> [9] -> [2] -> null |
Implement another function that merges two sorted linked lists into a single sorted linked list.