SlideShare a Scribd company logo
#include
#include
#include
using namespace std;
/*
* Node Declaration
*/
struct node
{
int info;
struct node *next;
}*last;
/*
* Class Declaration
*/
class circular_llist
{
public:
void create_node(int value);
void add_begin(int value);
void add_after(int value, int position);
void delete_element(int value);
void search_element(int value);
void display_list();
void update();
void sort();
circular_llist()
{
last = NULL;
}
};
/*
* Create Circular Link List
*/
void circular_llist::create_node(int value)
{
struct node *temp;
temp = new(struct node);
temp->info = value;
if (last == NULL)
{
last = temp;
temp->next = last;
}
else
{
temp->next = last->next;
last->next = temp;
last = temp;
}
}
/*
* Insertion of element at beginning
*/
void circular_llist::add_begin(int value)
{
if (last == NULL)
{
cout<<"First Create the list."<info = value;
temp->next = last->next;
last->next = temp;
}
/*
* Deletion of element from the list
*/
void circular_llist::delete_element(int value)
{
struct node *temp, *s;
s = last->next;
/* If List has only one element*/
if (last->next == last && last->info == value)
{
temp = last;
last = NULL;
free(temp);
return;
}
if (s->info == value) /*First Element Deletion*/
{
temp = s;
last->next = s->next;
free(temp);
return;
}
while (s->next != last)
{
/*Deletion of Element in between*/
if (s->next->info == value)
{
temp = s->next;
s->next = temp->next;
free(temp);
cout<<"Element "<next;
}
/*Deletion of last element*/
if (s->next->info == value)
{
temp = s->next;
s->next = last->next;
free(temp);
last = s;
return;
}
/*
* Display Circular Link List
*/
void circular_llist::display_list()
{
struct node *s;
if (last == NULL)
{
cout<<"List is empty, nothing to display"<
Solution
#include
#include
#include
using namespace std;
/*
* Node Declaration
*/
struct node
{
int info;
struct node *next;
}*last;
/*
* Class Declaration
*/
class circular_llist
{
public:
void create_node(int value);
void add_begin(int value);
void add_after(int value, int position);
void delete_element(int value);
void search_element(int value);
void display_list();
void update();
void sort();
circular_llist()
{
last = NULL;
}
};
/*
* Create Circular Link List
*/
void circular_llist::create_node(int value)
{
struct node *temp;
temp = new(struct node);
temp->info = value;
if (last == NULL)
{
last = temp;
temp->next = last;
}
else
{
temp->next = last->next;
last->next = temp;
last = temp;
}
}
/*
* Insertion of element at beginning
*/
void circular_llist::add_begin(int value)
{
if (last == NULL)
{
cout<<"First Create the list."<info = value;
temp->next = last->next;
last->next = temp;
}
/*
* Deletion of element from the list
*/
void circular_llist::delete_element(int value)
{
struct node *temp, *s;
s = last->next;
/* If List has only one element*/
if (last->next == last && last->info == value)
{
temp = last;
last = NULL;
free(temp);
return;
}
if (s->info == value) /*First Element Deletion*/
{
temp = s;
last->next = s->next;
free(temp);
return;
}
while (s->next != last)
{
/*Deletion of Element in between*/
if (s->next->info == value)
{
temp = s->next;
s->next = temp->next;
free(temp);
cout<<"Element "<next;
}
/*Deletion of last element*/
if (s->next->info == value)
{
temp = s->next;
s->next = last->next;
free(temp);
last = s;
return;
}
/*
* Display Circular Link List
*/
void circular_llist::display_list()
{
struct node *s;
if (last == NULL)
{
cout<<"List is empty, nothing to display"<

More Related Content

PDF
take the following code and give details of what each line of code i.pdf
PDF
#includeiostream #includecstdio #includecstdlib using na.pdf
PPTX
Link List Programming Linked List in Cpp
PDF
#includeiostream#includecstdio#includecstdlib Node .pdf
PDF
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
PDF
tested on eclipseDoublyLinkedList class.pdf
PDF
mainpublic class AssignmentThree {    public static void ma.pdf
PDF
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
take the following code and give details of what each line of code i.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
Link List Programming Linked List in Cpp
#includeiostream#includecstdio#includecstdlib Node .pdf
Help please, I have attached LinkedList.cpp and LinkedList.hPlease.pdf
tested on eclipseDoublyLinkedList class.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf

Similar to #includeiostream#includecstdio#includecstdlibusing names.pdf (20)

PDF
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
PDF
How do I fix it in javaLinkedList.java Defines a doubl.pdf
DOC
Ds 2 cycle
PDF
In C++Write a recursive function to determine whether or not a Lin.pdf
DOCX
DS UNIT4_OTHER LIST STRUCTURES.docx
PDF
How do you stop infinite loop Because I believe that it is making a.pdf
PDF
C++ Program to Implement Doubly Linked List #includei.pdf
PDF
Write a program that accepts an arithmetic expression of unsigned in.pdf
PPTX
DSA(1).pptx
DOCX
Linked lists
PDF
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
DOCX
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
PDF
Using the provided table interface table.h and the sample linked lis.pdf
DOCX
Linked Stack program.docx
PDF
ItemNodeh include ltiostreamgt include ltstring.pdf
DOCX
DS Code (CWH).docx
DOC
C program to insert a node in doubly linked list
PDF
#include iostream #include cstddefusing namespace std;temp.pdf
PDF
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PDF
Consider L = {a^nb^2nc^P p 0}. Prove L is not a context-free langu.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdf
Ds 2 cycle
In C++Write a recursive function to determine whether or not a Lin.pdf
DS UNIT4_OTHER LIST STRUCTURES.docx
How do you stop infinite loop Because I believe that it is making a.pdf
C++ Program to Implement Doubly Linked List #includei.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
DSA(1).pptx
Linked lists
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
Using the provided table interface table.h and the sample linked lis.pdf
Linked Stack program.docx
ItemNodeh include ltiostreamgt include ltstring.pdf
DS Code (CWH).docx
C program to insert a node in doubly linked list
#include iostream #include cstddefusing namespace std;temp.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
Consider L = {a^nb^2nc^P p 0}. Prove L is not a context-free langu.pdf

More from KUNALHARCHANDANI1 (20)

PDF
The metal will undergo oxidation forming metal ion and releasing .pdf
PDF
Static Keyword Static is a keyword in C++ used to give special chara.pdf
PDF
Sr2+ is most likely to substitute for Ca2+ becaus.pdf
PDF
may be that peak id due to presence of alkyl gro.pdf
PDF
There should only have one singlet resonance for .pdf
PDF
the link is not working can u pls write questions.pdf
PDF
The one have higher value of E(cell) is acting as.pdf
PDF
Nicotine has a molecular formula of C10H14N2 .pdf
PDF
i have it .pdf
PDF
HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf
PDF
Which of the following would be a description of a system unitA c.pdf
PDF
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
PDF
viruses which have single strande DNA in their genome come under cat.pdf
PDF
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
PDF
CH4 + 2O2 -- CO2 + 2H2O note CH4 combustion is.pdf
PDF
SbAspnSolutionSbAspn.pdf
PDF
Carbon 2 is where D and L differ for all sugars. .pdf
PDF
Program to print the Diamond Shape -#include stdio.h int ma.pdf
PDF
Part D option 4 is answerUnless untill they are exposed by some me.pdf
PDF
Isomers which have their atoms connected in the same sequence but di.pdf
The metal will undergo oxidation forming metal ion and releasing .pdf
Static Keyword Static is a keyword in C++ used to give special chara.pdf
Sr2+ is most likely to substitute for Ca2+ becaus.pdf
may be that peak id due to presence of alkyl gro.pdf
There should only have one singlet resonance for .pdf
the link is not working can u pls write questions.pdf
The one have higher value of E(cell) is acting as.pdf
Nicotine has a molecular formula of C10H14N2 .pdf
i have it .pdf
HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf
Which of the following would be a description of a system unitA c.pdf
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
viruses which have single strande DNA in their genome come under cat.pdf
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
CH4 + 2O2 -- CO2 + 2H2O note CH4 combustion is.pdf
SbAspnSolutionSbAspn.pdf
Carbon 2 is where D and L differ for all sugars. .pdf
Program to print the Diamond Shape -#include stdio.h int ma.pdf
Part D option 4 is answerUnless untill they are exposed by some me.pdf
Isomers which have their atoms connected in the same sequence but di.pdf

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Institutional Correction lecture only . . .
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Lesson notes of climatology university.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Basic Mud Logging Guide for educational purpose
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharma ospi slides which help in ospi learning
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Renaissance Architecture: A Journey from Faith to Humanism
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
VCE English Exam - Section C Student Revision Booklet
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Supply Chain Operations Speaking Notes -ICLT Program
Institutional Correction lecture only . . .
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Lesson notes of climatology university.
STATICS OF THE RIGID BODIES Hibbelers.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
GDM (1) (1).pptx small presentation for students
Basic Mud Logging Guide for educational purpose
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
RMMM.pdf make it easy to upload and study
Pharma ospi slides which help in ospi learning

#includeiostream#includecstdio#includecstdlibusing names.pdf

  • 1. #include #include #include using namespace std; /* * Node Declaration */ struct node { int info; struct node *next; }*last; /* * Class Declaration */ class circular_llist { public: void create_node(int value); void add_begin(int value); void add_after(int value, int position); void delete_element(int value); void search_element(int value); void display_list(); void update(); void sort(); circular_llist() { last = NULL; } }; /* * Create Circular Link List */ void circular_llist::create_node(int value)
  • 2. { struct node *temp; temp = new(struct node); temp->info = value; if (last == NULL) { last = temp; temp->next = last; } else { temp->next = last->next; last->next = temp; last = temp; } } /* * Insertion of element at beginning */ void circular_llist::add_begin(int value) { if (last == NULL) { cout<<"First Create the list."<info = value; temp->next = last->next; last->next = temp; } /* * Deletion of element from the list */ void circular_llist::delete_element(int value) { struct node *temp, *s; s = last->next; /* If List has only one element*/ if (last->next == last && last->info == value)
  • 3. { temp = last; last = NULL; free(temp); return; } if (s->info == value) /*First Element Deletion*/ { temp = s; last->next = s->next; free(temp); return; } while (s->next != last) { /*Deletion of Element in between*/ if (s->next->info == value) { temp = s->next; s->next = temp->next; free(temp); cout<<"Element "<next; } /*Deletion of last element*/ if (s->next->info == value) { temp = s->next; s->next = last->next; free(temp); last = s; return; } /* * Display Circular Link List */ void circular_llist::display_list()
  • 4. { struct node *s; if (last == NULL) { cout<<"List is empty, nothing to display"< Solution #include #include #include using namespace std; /* * Node Declaration */ struct node { int info; struct node *next; }*last; /* * Class Declaration */ class circular_llist { public: void create_node(int value); void add_begin(int value); void add_after(int value, int position); void delete_element(int value); void search_element(int value); void display_list(); void update(); void sort(); circular_llist() { last = NULL;
  • 5. } }; /* * Create Circular Link List */ void circular_llist::create_node(int value) { struct node *temp; temp = new(struct node); temp->info = value; if (last == NULL) { last = temp; temp->next = last; } else { temp->next = last->next; last->next = temp; last = temp; } } /* * Insertion of element at beginning */ void circular_llist::add_begin(int value) { if (last == NULL) { cout<<"First Create the list."<info = value; temp->next = last->next; last->next = temp; } /* * Deletion of element from the list */
  • 6. void circular_llist::delete_element(int value) { struct node *temp, *s; s = last->next; /* If List has only one element*/ if (last->next == last && last->info == value) { temp = last; last = NULL; free(temp); return; } if (s->info == value) /*First Element Deletion*/ { temp = s; last->next = s->next; free(temp); return; } while (s->next != last) { /*Deletion of Element in between*/ if (s->next->info == value) { temp = s->next; s->next = temp->next; free(temp); cout<<"Element "<next; } /*Deletion of last element*/ if (s->next->info == value) { temp = s->next; s->next = last->next; free(temp); last = s;
  • 7. return; } /* * Display Circular Link List */ void circular_llist::display_list() { struct node *s; if (last == NULL) { cout<<"List is empty, nothing to display"<