class LinkListNode
{
friend class LinkList;
private:
int data;
LinkListNode *llink, * rlink;
};
class LinkList
LinkListNode *start;
// Basic form of deleting node from LinkList
void delete ( int x , node * start )
node *p ;
p = start → rlink ;
while ( p && p →data < x )
p = p → rlink ;
if ( p = = Null | | p → data > x )
return " There isn't any data " ;
( p →llink ) → rlink = p → rlink ;
( p →rlink ) → llink = p → llink ;
delete ( p ) ;
}
First Fuction:
// deleting node which are at the middle of the Doubly LinkList (Second Type: first node and last node have link between together.)
void LinkList::Delete(ListLink *x)
if(x==start)
cout<<" There is no data to delete ."
else
x → llink → rlink = x → rlink;
x → rlink → llink = x → llink;
delete x;
Second Function:
// deleting node which are at the end of the Doubly LinkList(Second type)
cout<<"There is no data to delete."
x → llink = x → rlink;
Third Function:
// deleting node which are at the beginning of the Doubly LinkList(Second Type)
Forth Function:
// deleting node which are at the Beginning of the Doubly LinkList(First Type: First node and last node doesn’t have any link between them.)
x → llink → rlink = null;
x → llink = null;
Fifth Function:
// deleting node which are at the end of the Doubly LinkList (First type)
x → rlink = null;
x → rlink → llink = null;
Sixth Function:
Note: The Sixth Function and First Function are the same.