We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
@wuxi9007 could you help with my code, i'm able to get only the end elements, but not the middle ones.
Node*MergeLists(Node*headA,Node*headB){// This is a "method-only" submission. // You only need to complete this methodNode*temp,*headFinal;if(headA!=NULL&&headB!=NULL){if(headA->data<headB->data)headFinal=headA;elseheadFinal=headB;}elseif(headA!=NULL){headFinal=headA;}elseheadFinal=headB;temp=headFinal;while(headA!=NULL&&headB!=NULL){if(headA->data<headB->data){temp->next=headB;headA=headA->next;}else{temp->next=headA;headB=headB->next;}}returnheadFinal;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
@wuxi9007 could you help with my code, i'm able to get only the end elements, but not the middle ones.