What’s wrong with my function ? I am trying to merge 2 sorted linked lists( xHead and yHead )…

What’s wrong with my function ? I am trying to merge 2 sorted linked lists( xHead and yHead ) into a third one (zHead) sorted, via recursion. Something is wrong with it void SortedMergeRecur(Node*& xHead,Node*& yHead,Node*& zHead) { Node* temp = 0; if(xHead == 0) { zHead = yHead; yHead = 0; } else if(yHead == 0) { zHead = xHead; xHead = 0; } else if(xHead != NULL && yHead != NULL) { if(xHead -> data [removed] data) { zHead = xHead; SortedMergeRecur(xHead -> link, yHead, zHead -> link); xHead = 0; } else if(xHead -> data == yHead -> data) { zHead = yHead; SortedMergeRecur(xHead, yHead -> link, zHead -> link); yHead = 0; } } return; }

“Order a similar paper and get 20% discount on your first order with us Use the following coupon “FIRST20”

 

Posted in Uncategorized