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;
}
- 9 years ago
- 10
Answer(1)
Purchase the answer to view it
NOT RATED
- aaaaaaaaaaaa.docx
Bids(0)
other Questions(10)
- I can't figure out how to put a visual logic if condition into a flow chat. Can you help me?
- Global Business
- Eco homework question
- I need some extra credit quiz done for my pre-algebra class!
- what are alleles?
- six and one third subtracted by four and a half
- based on information in the story,eplain why riley doesnt think he is going to have fun on the trip. use...
- in vain
- The sign shows the cost of renting a
- Design a program to increase volunteer participation in a community action program using the premise that if you can get...
Tips(0)