- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hi! (Nerd)
Given a tree, I want to write an algorithm, that deletes from each node, from the corresponding ordered binary tree, the rightmost child, that is a leaf.
That's what I have tried:
Could you tell me if it is right?
Given a tree, I want to write an algorithm, that deletes from each node, from the corresponding ordered binary tree, the rightmost child, that is a leaf.
That's what I have tried:
Code:
Algorithm(NODE *P){
if (P==NULL) return error;
if (P->RC!=NULL) P=P->RC;
if (P->LC!=NULL) Algorithm(P->LC);
if (P->RC==NULL) P->LC->RC=NULL;
Algorithm(P->RC)
Could you tell me if it is right?
Last edited: