954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help to get algorithm for doubly linked list ...

please provide me doubly linked list all algorithms......

shylesh_kerala
Newbie Poster
6 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 
griswolf
Veteran Poster
1,165 posts since Apr 2010
Reputation Points: 344
Solved Threads: 256
 

Check these links link 1 .... link2

abelLazm
Postaholic
2,113 posts since Feb 2011
Reputation Points: 219
Solved Threads: 124
 
Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

There are two function use in double link list Insert or delete. both algorithems are following
INSERT:-
1.if(List=Full)Then return=0 end if
Else
2.found = Search list(list,pPre,pSucc,datain)
3.if (not found)then Allocate(pnew)
pNew->data=datain
4.if (pPre is null)
1.pNew ->back=NULL
2.pnew ->fore = list.head
3.list.head=pNew else
1.pNew-> fore = pPre->fore
2.pNew ->back=pPre end if
6.if (pPre ->fore NULL) then list.rear=pNew else
1.pSucc->back=pNew
8.end if
9.pPre->fore=pNew
10.list.coount=list.count+1
11.return(1)
5.endif
6.return(2)
END algorithm.

DELETE:-
1.if(pdlt NULL)
1.abort (impossible condition in delete double)
2.end if
3.list.count=list.count+1
4.if(pDlt->back ot NULL)
1.pPred=pDlt->back
2.pPred->fore=pDlt->fore
5.else
1.list.head=pDlt->fore
6.endif
7.if (pDlt->fore not NULL)
1.pSucc=pDlt->fore
2.pSucc->back=pDlt->back
8.else
1.list.rear=pDlt->back
9.end if
10.recycle(pDlt)
11.return
End algorithm

antechindia
Newbie Poster
16 posts since May 2011
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: