Priority queue as binary search tree - implementation problem?

DianaMC

New member
I need to implement a priority queue using a binary search tree. I use another class for nodes; however, my project crashes when I return a pointer (specifically, when I want to set a node's left descendant to another node's right descendant - it crashes at the function that returns the right descendant). Is it wrong to return a pointer to a node to use further? What's the correct overloading of the = operator, when asserting nodes?

Also, I'm not particularly sure if my implementation is correct - I mean the insertion and especially extraction of elements. What would the correct implementation be?
 
Back
Top