Ditutup

What's wrong with my function ? I am trying to merge 2 sorte

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 < yHead -> 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;

}

i will pay 5 dollar for it.

Kemahiran: PHP, Kejuruteraan Perisian

Lihat lebih lanjut: sortedmergerecur, what is recursion function, what is recursion, what is a temp, recursion function, wrong, what is software architecture, what is node, what, what if, VOID, i am, function, trying, function recursion, php node, null software, function merge, write function merge lists, php recursion, php merge, i`m trying voice input flash, excel function price wrong, data function, linked lists

Tentang Majikan:
( 0 ulasan ) kolkata, India

ID Projek: #1592892

2 freelancers are bidding on average $140 for this job

Mn7Y4JC9s

Pls check PMB.

$250 USD dalam sehari
(0 Ulasan)
0.0
migandhilx

if there s something wrong in the logic then it can be fixed by stepping through the algorithm with some sample values..

$30 USD dalam sehari
(0 Ulasan)
0.0