?
Given the pseudo code, state whether the function for merging of two heap is correct or not?
Given the pseudo code, state whether the function for merging of two heap is correct or not?
mergeTree(p,q)
if p.root.value <= q.root.value
return p.addTree(q)
else
return q.addTree(p)
mergeTree(p,q)
if p.root.value <= q.root.value
return p.addTree(q)
else
return q.addTree(p)
Join the Discussion
Login to post a comment or share your explanation.
Login