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

Assignment Help:

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


Related Discussions:- Algorithm to add element in the end of circular linked list

What do you understand by tree traversal, What do you understand by tree tr...

What do you understand by tree traversal? The algorithm walks by the tree data structure and performs some computation at everynode in the tree. This process of walking by the

Applications of linear and binary search, The searching method are applicab...

The searching method are applicable to a number of places in current's world, may it be Internet, search engines, text pattern matching, on line enquiry, finding a record from data

Adjacency matrix of an undirected graph, 1) What will call a graph that hav...

1) What will call a graph that have no cycle? 2) Adjacency matrix of an undirected graph is------------- on main diagonal. 3) Represent the following graphs by adjacency matr

Sorting, explain quick sort algorithm

explain quick sort algorithm

State phong shading, Phong Shading Phong shading too is based on interp...

Phong Shading Phong shading too is based on interpolation, but instead of interpolating the colour value, it is the normal vector, which is interpolated for each point and a co

Abstract data type-tree, Definition: A set of data values & related operati...

Definition: A set of data values & related operations that are accurately specified independent of any particular implementation. As the data values and operations are described

Array implementation of a circular queue, A circular queue can be implement...

A circular queue can be implemented through arrays or linked lists. Program 6 gives the array implementation of any circular queue. Program 6: Array implementation of any Circu

Queues, Queue is a linear data structure utilized in several applications o...

Queue is a linear data structure utilized in several applications of computer science. Such as people stand in a queue to get a specific service, several processes will wait in a q

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