Algorithm to add element in the end of circular linked list, Data Structure & Algorithms

Q. Write down an algorithm to add an element in the end of the circular linked list.       

Ans.

Algorithm to Add the Element at the End of Circular Linked Lists written below.

IINSENDCLL( INFO, LINK, START, AVAIL, ITEM) The algorithm deletes last element from the circular linked list.

1.  [OVERFLOW?] if AVAIL = NULL, then Write:

OVERFLOW, and Exit.

2.  [Remove first node from the AVAIL: = LIN[AVAIL].

a.  Set NEW:= AVAIL and AVAIL:=LINK[AVAIL].

3.  Set INFO[NEW]:=ITEM. [copies new data into new node.]

4.  Set  PTR:= LINK[START] and SAVE:=START.[initializes popinters]

5.  Repeat while LINK[PTR]!=START: [ Traverses list seeking last node.]

a.  Set PTR:=LINK[PTR]. [Updates PTR] [ End of loop]

6.  Set LINK [PTR]:= NEW. [ Attaches new node to the last node of the list]

7.  Set LINK[NEW]:= START [ New node now points to the original first node.]

8.  Exit

Posted Date: 7/13/2012 2:12:07 AM | Location : United States







Related Discussions:- Algorithm to add element in the end of circular linked list, Assignment Help, Ask Question on Algorithm to add element in the end of circular linked list, Get Answer, Expert's Help, Algorithm to add element in the end of circular linked list Discussions

Write discussion on Algorithm to add element in the end of circular linked list
Your posts are moderated
Related Questions
What is complexity of an algorithm? What is the basic relation between the time and space complexities of an algorithm? Justify your answer by giving an example.

In computer programming, Trees are utilized enormously. These can be utilized for developing database search times (binary search trees, AVL trees, 2-3 trees, red-black trees), Gam

A full binary tree with 2n+1 nodes have n non-leaf nodes

Define data model?  A data model is a collection of conceptual tools for explaning data, data relationships, data semantics and consistency constraints.

Regis lives in Brazil and frequently travels to USA, Japan and Europe. He wants to be able to convert Brazilian Reais into US dollars, European euros and Japanese yen. Conversion f

Decision Tree A decision tree is a diagram that shows conditions and actions sequentially and therefore shows which condition is to be considered first, second and so on. It is

Example which cause problems for some hidden-surface algorithms Some special cases, which cause problems for some hidden-surface algorithms, are penetrating faces and cyclic ov

The following DNA sequences are extracted from promoter region of genes which are co-regulated by the same transcription factor (TF). The nucleotide segments capitalized in the giv

I need help writing a pseudocode for my assignment can anyone help?

infix to revrse polish