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

COBOL, write a COBOL program to find the biggest of two numbers

write a COBOL program to find the biggest of two numbers

Visual Basic Assignment, When writing a code for a program that basically a...

When writing a code for a program that basically answers Relative Velocity questions how do you go at it? How many conditions should you go through?

Inequalities, #question.show that the following inequality is correct or in...

#question.show that the following inequality is correct or incorrect. n!=O(n^n)

Draw trace table and determine output of number, Draw trace table and deter...

Draw trace table and determine output from the following flowchart using following data: Number = 45, -2, 20.5

Insert an element after an element pointed by some pointer, Consider a link...

Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer? O (1)

Demonstration of polynomial using linked list, Demonstration of Polynomial ...

Demonstration of Polynomial using Linked List # include # include Struct link { Char sign; intcoef; int expo; struct link *next; }; Typedefstruct link

Collision resolution techniques, complete information about collision resol...

complete information about collision resolution techniques

Algorithsm, What are the properties of an algorithsm?

What are the properties of an algorithsm?

Data communication, #question.explain different types of errors in data tra...

#question.explain different types of errors in data transmission.

What is gouraud shading, Gouraud Shading The faceted appearance of a La...

Gouraud Shading The faceted appearance of a Lambert shaded model is due to each polygon having only a single colour. To avoid this effect, it is necessary to vary the colour ac

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