Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node* interleave(Node* list1, Node* list2){
- // ******** WRITE YOUR CODE HERE ********
- Node *returnList = new Node();
- Node *temp = new Node();
- if(list2 == NULL){
- copy(list1, returnList);
- return returnList;
- }
- if(list1 == NULL){
- copy(list2, returnList);
- return returnList;
- }
- copy(list1, returnList);
- returnList->next=temp;
- while(list1->next != NULL && list2->next != NULL){
- copy(list2,temp);
- copy(list1->next, temp->next);
- list1=list1->next;
- list2=list2->next;
- }
- return returnList;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement