SlideShare a Scribd company logo
#include
#include
#include
/*
* Node Declaration
*/
using namespace std;
struct node
{
int info;
struct node *next;
struct node *prev;
}*start;
/*
Class Declaration
*/
class double_llist
{
public:
void create_list(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_dlist();
void count();
void reverse();
double_llist()
{
start = NULL;
}
};
/*
* Main: Conatins Menu
*/
int main()
{
int choice, element, position;
double_llist dl;
while (1)
{
cout<>choice;
switch ( choice )
{
case 1:
cout<<"Enter the element: ";
cin>>element;
dl.create_list(element);
cout<>element;
dl.add_begin(element);
cout<>element;
cout<<"Insert Element after postion: ";
cin>>position;
dl.add_after(element, position);
cout<>element;
dl.delete_element(element);
cout<info = value;
temp->next = NULL;
if (start == NULL)
{
temp->prev = NULL;
start = temp;
}
else
{
s = start;
while (s->next != NULL)
s = s->next;
s->next = temp;
temp->prev = s;
}
}
/*
* Insertion at the beginning
*/
void double_llist::add_begin(int value)
{
if (start == NULL)
{
cout<<"First Create the list."<prev = NULL;
temp->info = value;
temp->next = start;
start->prev = temp;
start = temp;
cout<<"Element Inserted"<next;
if (q == NULL)
{
cout<<"There are less than ";
cout<info = value;
if (q->next == NULL)
{
q->next = tmp;
tmp->next = NULL;
tmp->prev = q;
}
else
{
tmp->next = q->next;
tmp->next->prev = tmp;
q->next = tmp;
tmp->prev = q;
}
cout<<"Element Inserted"<info == value)
{
tmp = start;
start = start->next;
start->prev = NULL;
cout<<"Element Deleted"<next->next != NULL)
{
/*Element deleted in between*/
if (q->next->info == value)
{
tmp = q->next;
q->next = tmp->next;
tmp->next->prev = q;
cout<<"Element Deleted"<next;
}
/*last element deleted*/
if (q->next->info == value)
{
tmp = q->next;
free(tmp);
q->next = NULL;
cout<<"Element Deleted"<info<<" <-> ";
q = q->next;
}
cout<<"NULL"<next;
cnt++;
}
cout<<"Number of elements are: "<next;
p1->next = NULL;
p1->prev = p2;
while (p2 != NULL)
{
p2->prev = p2->next;
p2->next = p1;
p1 = p2;
p2 = p2->prev;
}
start = p1;
cout<<"List Reversed"<
Solution
#include
#include
#include
/*
* Node Declaration
*/
using namespace std;
struct node
{
int info;
struct node *next;
struct node *prev;
}*start;
/*
Class Declaration
*/
class double_llist
{
public:
void create_list(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_dlist();
void count();
void reverse();
double_llist()
{
start = NULL;
}
};
/*
* Main: Conatins Menu
*/
int main()
{
int choice, element, position;
double_llist dl;
while (1)
{
cout<>choice;
switch ( choice )
{
case 1:
cout<<"Enter the element: ";
cin>>element;
dl.create_list(element);
cout<>element;
dl.add_begin(element);
cout<>element;
cout<<"Insert Element after postion: ";
cin>>position;
dl.add_after(element, position);
cout<>element;
dl.delete_element(element);
cout<info = value;
temp->next = NULL;
if (start == NULL)
{
temp->prev = NULL;
start = temp;
}
else
{
s = start;
while (s->next != NULL)
s = s->next;
s->next = temp;
temp->prev = s;
}
}
/*
* Insertion at the beginning
*/
void double_llist::add_begin(int value)
{
if (start == NULL)
{
cout<<"First Create the list."<prev = NULL;
temp->info = value;
temp->next = start;
start->prev = temp;
start = temp;
cout<<"Element Inserted"<next;
if (q == NULL)
{
cout<<"There are less than ";
cout<info = value;
if (q->next == NULL)
{
q->next = tmp;
tmp->next = NULL;
tmp->prev = q;
}
else
{
tmp->next = q->next;
tmp->next->prev = tmp;
q->next = tmp;
tmp->prev = q;
}
cout<<"Element Inserted"<info == value)
{
tmp = start;
start = start->next;
start->prev = NULL;
cout<<"Element Deleted"<next->next != NULL)
{
/*Element deleted in between*/
if (q->next->info == value)
{
tmp = q->next;
q->next = tmp->next;
tmp->next->prev = q;
cout<<"Element Deleted"<next;
}
/*last element deleted*/
if (q->next->info == value)
{
tmp = q->next;
free(tmp);
q->next = NULL;
cout<<"Element Deleted"<info<<" <-> ";
q = q->next;
}
cout<<"NULL"<next;
cnt++;
}
cout<<"Number of elements are: "<next;
p1->next = NULL;
p1->prev = p2;
while (p2 != NULL)
{
p2->prev = p2->next;
p2->next = p1;
p1 = p2;
p2 = p2->prev;
}
start = p1;
cout<<"List Reversed"<

More Related Content

PDF
C++ Program to Implement Doubly Linked List #includei.pdf
PPTX
Double linked list
DOCX
C++ detyrat postim_slideshare
DOC
Ds 2 cycle
PDF
In C++Write a recursive function to determine whether or not a Lin.pdf
PDF
take the following code and give details of what each line of code i.pdf
PDF
Using the C++ programming language1. Implement the UnsortedList cl.pdf
PDF
#includeiostream#includecstdio#includecstdlibusing names.pdf
C++ Program to Implement Doubly Linked List #includei.pdf
Double linked list
C++ detyrat postim_slideshare
Ds 2 cycle
In C++Write a recursive function to determine whether or not a Lin.pdf
take the following code and give details of what each line of code i.pdf
Using the C++ programming language1. Implement the UnsortedList cl.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf

Similar to #includeiostream#includecstdio#includecstdlib Node .pdf (20)

PDF
#includeiostream #includecstdio #includecstdlib using na.pdf
PDF
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
PDF
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
PPTX
Single linked list
PDF
C++ Program to Implement Singly Linked List #includei.pdf
PPTX
Circular linked list
PDF
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
PDF
Data Structure in C++Doubly Linked Lists of ints httpstaffwww.pdf
PDF
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
PDF
C++ Program to Implement Singly Linked List #includeiostream.pdf
PDF
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
DOCX
Linked lists
PDF
Using C++I keep getting messagehead does not name a type.pdf
PDF
In the class we extensively discussed a node class called IntNode in.pdf
DOC
Final ds record
PDF
Implement a priority queue using a doublyLinked-cpp where the node wit.pdf
PDF
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
PDF
Need to be done in C++ Please Sorted number list implementation wit.pdf
DOC
Ds program-print
#includeiostream #includecstdio #includecstdlib using na.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Single linked list
C++ Program to Implement Singly Linked List #includei.pdf
Circular linked list
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
Data Structure in C++Doubly Linked Lists of ints httpstaffwww.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
C++ Program to Implement Singly Linked List #includeiostream.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
Linked lists
Using C++I keep getting messagehead does not name a type.pdf
In the class we extensively discussed a node class called IntNode in.pdf
Final ds record
Implement a priority queue using a doublyLinked-cpp where the node wit.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
Ds program-print

More from gulshan16175gs (20)

PDF
(deftemp Animal   (slot loc      (default greencouch))   (slot.pdf
PDF
2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
PDF
# Imports# Include your imports here, if any are used. import.pdf
PDF
The OMe is a strong electron withdrawing group an.pdf
PDF
O bears three lone pairs and is bound to a H, thu.pdf
PDF
Nacl and H20 so, Salt & water .pdf
PDF
In terms of ion charge, we notice that the charge.pdf
PDF
Here are four characteristics of acid a) A char.pdf
PDF
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdf
PDF
wrongSolutionwrong.pdf
PDF
You can use the below function for linear interpolation i.e.#inclu.pdf
PDF
These are the following tool to build a data model for an applicatio.pdf
PDF
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
PDF
Water is a good solvent due to its polarity. The oxygen atom in wate.pdf
PDF
V. The two types of larvae found in the life cycle of Diphyllobothri.pdf
PDF
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
PDF
The voltmeter reading indicates that Zn is the negative electrode an.pdf
PDF
The foreign exchange market facilitates the exchange of Currencies. .pdf
PDF
c. defendant that the complaint lacks true facts .pdf
PDF
bonde order of NO in nitrate 1.33 in nitrite is 1.pdf
(deftemp Animal   (slot loc      (default greencouch))   (slot.pdf
2. The pressures of O2 and NO will be negligibleSolution 2. T.pdf
# Imports# Include your imports here, if any are used. import.pdf
The OMe is a strong electron withdrawing group an.pdf
O bears three lone pairs and is bound to a H, thu.pdf
Nacl and H20 so, Salt & water .pdf
In terms of ion charge, we notice that the charge.pdf
Here are four characteristics of acid a) A char.pdf
Fe^3+(aq)Lewis acid H2O(l)Lewis baseereyedcommu .pdf
wrongSolutionwrong.pdf
You can use the below function for linear interpolation i.e.#inclu.pdf
These are the following tool to build a data model for an applicatio.pdf
Copper (II) Sulfate = CuSO4 Tin (IV) Oxide = SnO2.pdf
Water is a good solvent due to its polarity. The oxygen atom in wate.pdf
V. The two types of larvae found in the life cycle of Diphyllobothri.pdf
The tolerance has been given as +-0.05 inchSolutionThe tolera.pdf
The voltmeter reading indicates that Zn is the negative electrode an.pdf
The foreign exchange market facilitates the exchange of Currencies. .pdf
c. defendant that the complaint lacks true facts .pdf
bonde order of NO in nitrate 1.33 in nitrite is 1.pdf

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Cell Structure & Organelles in detailed.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
01-Introduction-to-Information-Management.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Computing-Curriculum for Schools in Ghana
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
2.FourierTransform-ShortQuestionswithAnswers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Anesthesia in Laparoscopic Surgery in India
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
A systematic review of self-coping strategies used by university students to ...
Cell Structure & Organelles in detailed.
Abdominal Access Techniques with Prof. Dr. R K Mishra
01-Introduction-to-Information-Management.pdf
human mycosis Human fungal infections are called human mycosis..pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Weekly quiz Compilation Jan -July 25.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Final Presentation General Medicine 03-08-2024.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
VCE English Exam - Section C Student Revision Booklet
Computing-Curriculum for Schools in Ghana

#includeiostream#includecstdio#includecstdlib Node .pdf

  • 1. #include #include #include /* * Node Declaration */ using namespace std; struct node { int info; struct node *next; struct node *prev; }*start; /* Class Declaration */ class double_llist { public: void create_list(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_dlist(); void count(); void reverse(); double_llist() { start = NULL; } }; /* * Main: Conatins Menu */
  • 2. int main() { int choice, element, position; double_llist dl; while (1) { cout<>choice; switch ( choice ) { case 1: cout<<"Enter the element: "; cin>>element; dl.create_list(element); cout<>element; dl.add_begin(element); cout<>element; cout<<"Insert Element after postion: "; cin>>position; dl.add_after(element, position); cout<>element; dl.delete_element(element); cout<info = value; temp->next = NULL; if (start == NULL) { temp->prev = NULL; start = temp; } else { s = start; while (s->next != NULL) s = s->next; s->next = temp; temp->prev = s; }
  • 3. } /* * Insertion at the beginning */ void double_llist::add_begin(int value) { if (start == NULL) { cout<<"First Create the list."<prev = NULL; temp->info = value; temp->next = start; start->prev = temp; start = temp; cout<<"Element Inserted"<next; if (q == NULL) { cout<<"There are less than "; cout<info = value; if (q->next == NULL) { q->next = tmp; tmp->next = NULL; tmp->prev = q; } else { tmp->next = q->next; tmp->next->prev = tmp; q->next = tmp; tmp->prev = q; } cout<<"Element Inserted"<info == value) { tmp = start; start = start->next;
  • 4. start->prev = NULL; cout<<"Element Deleted"<next->next != NULL) { /*Element deleted in between*/ if (q->next->info == value) { tmp = q->next; q->next = tmp->next; tmp->next->prev = q; cout<<"Element Deleted"<next; } /*last element deleted*/ if (q->next->info == value) { tmp = q->next; free(tmp); q->next = NULL; cout<<"Element Deleted"<info<<" <-> "; q = q->next; } cout<<"NULL"<next; cnt++; } cout<<"Number of elements are: "<next; p1->next = NULL; p1->prev = p2; while (p2 != NULL) { p2->prev = p2->next; p2->next = p1; p1 = p2; p2 = p2->prev; } start = p1; cout<<"List Reversed"< Solution
  • 5. #include #include #include /* * Node Declaration */ using namespace std; struct node { int info; struct node *next; struct node *prev; }*start; /* Class Declaration */ class double_llist { public: void create_list(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_dlist(); void count(); void reverse(); double_llist() { start = NULL; } }; /* * Main: Conatins Menu */
  • 6. int main() { int choice, element, position; double_llist dl; while (1) { cout<>choice; switch ( choice ) { case 1: cout<<"Enter the element: "; cin>>element; dl.create_list(element); cout<>element; dl.add_begin(element); cout<>element; cout<<"Insert Element after postion: "; cin>>position; dl.add_after(element, position); cout<>element; dl.delete_element(element); cout<info = value; temp->next = NULL; if (start == NULL) { temp->prev = NULL; start = temp; } else { s = start; while (s->next != NULL) s = s->next; s->next = temp; temp->prev = s; }
  • 7. } /* * Insertion at the beginning */ void double_llist::add_begin(int value) { if (start == NULL) { cout<<"First Create the list."<prev = NULL; temp->info = value; temp->next = start; start->prev = temp; start = temp; cout<<"Element Inserted"<next; if (q == NULL) { cout<<"There are less than "; cout<info = value; if (q->next == NULL) { q->next = tmp; tmp->next = NULL; tmp->prev = q; } else { tmp->next = q->next; tmp->next->prev = tmp; q->next = tmp; tmp->prev = q; } cout<<"Element Inserted"<info == value) { tmp = start; start = start->next;
  • 8. start->prev = NULL; cout<<"Element Deleted"<next->next != NULL) { /*Element deleted in between*/ if (q->next->info == value) { tmp = q->next; q->next = tmp->next; tmp->next->prev = q; cout<<"Element Deleted"<next; } /*last element deleted*/ if (q->next->info == value) { tmp = q->next; free(tmp); q->next = NULL; cout<<"Element Deleted"<info<<" <-> "; q = q->next; } cout<<"NULL"<next; cnt++; } cout<<"Number of elements are: "<next; p1->next = NULL; p1->prev = p2; while (p2 != NULL) { p2->prev = p2->next; p2->next = p1; p1 = p2; p2 = p2->prev; } start = p1; cout<<"List Reversed"<