SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
#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"<

Mais conteúdo relacionado

Semelhante a #includeiostream#includecstdio#includecstdlibusing names.pdf

How do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdfHow do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdffmac5
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfflashfashioncasualwe
 
DS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxDS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxVeerannaKotagi1
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
 
C++ Program to Implement Doubly Linked List #includei.pdf
  C++ Program to Implement Doubly Linked List  #includei.pdf  C++ Program to Implement Doubly Linked List  #includei.pdf
C++ Program to Implement Doubly Linked List #includei.pdfLalkamal2
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfJUSTSTYLISH3B2MOHALI
 
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
Solution#includestdio.h#includeconio.h#includealloc.h.pdfSolution#includestdio.h#includeconio.h#includealloc.h.pdf
Solution#includestdio.h#includeconio.h#includealloc.h.pdfpoddaranand1
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhvasavim9
 
Using the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdfUsing the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdfconnellalykshamesb60
 
ItemNodeh include ltiostreamgt include ltstring.pdf
ItemNodeh    include ltiostreamgt include ltstring.pdfItemNodeh    include ltiostreamgt include ltstring.pdf
ItemNodeh include ltiostreamgt include ltstring.pdfacmefit
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked listSourav Gayen
 
#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdfkaran8801
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfclimatecontrolsv
 
Consider L = {a^nb^2nc^P p 0}. Prove L is not a context-free langu.pdf
Consider L = {a^nb^2nc^P  p  0}. Prove L is not a context-free langu.pdfConsider L = {a^nb^2nc^P  p  0}. Prove L is not a context-free langu.pdf
Consider L = {a^nb^2nc^P p 0}. Prove L is not a context-free langu.pdfbharatchawla141
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfanwarsadath111
 

Semelhante a #includeiostream#includecstdio#includecstdlibusing names.pdf (20)

How do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdfHow do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdf
 
Ds 2 cycle
Ds 2 cycleDs 2 cycle
Ds 2 cycle
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
 
DS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docxDS UNIT4_OTHER LIST STRUCTURES.docx
DS UNIT4_OTHER LIST STRUCTURES.docx
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
C++ Program to Implement Doubly Linked List #includei.pdf
  C++ Program to Implement Doubly Linked List  #includei.pdf  C++ Program to Implement Doubly Linked List  #includei.pdf
C++ Program to Implement Doubly Linked List #includei.pdf
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
 
DSA(1).pptx
DSA(1).pptxDSA(1).pptx
DSA(1).pptx
 
Linked lists
Linked listsLinked lists
Linked lists
 
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
Solution#includestdio.h#includeconio.h#includealloc.h.pdfSolution#includestdio.h#includeconio.h#includealloc.h.pdf
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
 
Using the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdfUsing the provided table interface table.h and the sample linked lis.pdf
Using the provided table interface table.h and the sample linked lis.pdf
 
Linked Stack program.docx
Linked Stack program.docxLinked Stack program.docx
Linked Stack program.docx
 
ItemNodeh include ltiostreamgt include ltstring.pdf
ItemNodeh    include ltiostreamgt include ltstring.pdfItemNodeh    include ltiostreamgt include ltstring.pdf
ItemNodeh include ltiostreamgt include ltstring.pdf
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked list
 
#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.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
Consider L = {a^nb^2nc^P  p  0}. Prove L is not a context-free langu.pdfConsider L = {a^nb^2nc^P  p  0}. Prove L is not a context-free langu.pdf
Consider L = {a^nb^2nc^P p 0}. Prove L is not a context-free langu.pdf
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
 

Mais de KUNALHARCHANDANI1

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

Mais de KUNALHARCHANDANI1 (20)

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

Último

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Último (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

#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"<