ErrorCode PNode::delete(int lastchecked, int _deleteKey, PNode * &orphan){

If(leaf){

            If(myRecord->key ==_deleteKey)

                        ReturnValue = present;

            Else

                        ReturnValue = not_present;

}//end if leaf code

 

else{ //not a leaf

            //first drop down to a leaf

            //then check what happened

 

            //first drop down to a leaf

            if(check(mycheckbit, _deleteKey) == 0){

                        path = zero

                        notpath = one

            }

            returnValue = path->delete(mycheckbit, _deleteKey, orphan);

 

 

            //then check what happened

            If(returnValue == present, just returning from leaf node){

                        //check what case it is, do what is necessary for each case

                        if(path == self)//first case

                                    here’s where your code goes

                        elseif(notpath == self)//second case

                                    here’s where your code goes

                        else//third case

                                    //find who points to me

                                    //tell them to point to the deletion Node

                                    //swap records with the deletion Node

                                    //orphan = notpath

                        returnValue = ready to be deleted

            }

            else if(returnValue ==ready to be deleted){

                        delete path;

                        path = orphan;

                        returnValue = done;

            }

}

return returnValue;

}