Algorithm to add an element at the end of linked list, Data Structure & Algorithms

Assignment Help:

Write an algorithm to add an element at the end of circular linked list.  

Algorithm to Add the Element at the End of Circular Linked List.

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

 


Related Discussions:- Algorithm to add an element at the end of linked list

What are expression trees, What are expression trees?  The leaves of an...

What are expression trees?  The leaves of an expression tree are operands, like as constants or variable names, and the other nodes have operators. This certain tree happens to

Write stream analogues of list processing functions, (a) Write (delay ) as...

(a) Write (delay ) as a special form for (lambda () ) and (force ), as discussed in class. (b) Write (stream-cons x y) as a special form, as discussed in class. (c) Write

Chaining Method as Method of Collision Resolution , Q. The given values are...

Q. The given values are to be stored in a hash table 25, 42, 96, 101, 102, 162, 197 Explain how the values are hashed by using division technique of hashing with a table

B-TREE and AVL tree diffrance, Explain process of B-TREE and what differen...

Explain process of B-TREE and what difference between AVL Tree Using Algorithms

Define a b-tree, Define a B-Tree Justas AVL trees are balanced binary s...

Define a B-Tree Justas AVL trees are balanced binary search trees, B-trees are balanced M-way search trees. A B-Tree of order M is either the empty tree or it is an M-way searc

Tree, tree is graph or not

tree is graph or not

Write an algorithm outputs number of books using psuedocode, A shop sells b...

A shop sells books, maps and magazines. Every item is identified by a unique 4 - digit code. All books have a code starting with a 1, all maps have a code which starts with a 2 and

Time converstion, how to convert 12 hour format into 24 hour format using c...

how to convert 12 hour format into 24 hour format using c program

Write algorithm for post-order traversal, P os t - o r d e r T ...

P os t - o r d e r T r av er sal :  This can be done by both iteratively and recursively. The iterative solution would require a modification or alteration of the in-

Sorting, Retrieval of information is made simpler when it is stored into so...

Retrieval of information is made simpler when it is stored into some predefined order. Therefore, Sorting is a very important computer application activity. Several sorting algorit

5/11/2013 12:53:03 AM

Thanks for suggesting me this answer, appreciate your knowledge.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd