SlideShare a Scribd company logo
1 of 7
Download to read offline
#include
#include
using namespace std;
template class Node{
private:
T value;
Node *next;
public:
Node();
Node (T data);
T remove();
T getValue();
Node* getNext();
void setValue(T data);
void setNext(Node *nextNode);
};
template
Node::Node(){
T value =NULL;
}
template
Node::Node(T data){
T value=data;
}
template
T Node::getValue(){
return value;
}
template
Node* Node::getNext(){
return next;
}
template
void Node::setValue(T data){
T value=data;
}
template
void Node::setNext(Node *nextNode){
next=nextNode;
}
template class MyLinkedList{
Node start;
//Define a constructor
MyLinkedList()
{
start->setValue(0);
start->setNext(NULL);
}
//Member Functions:
// Adds a new element to the list
void add (T val)
{
/* creating a new node to hold value*/
Nodetemp(val,NULL);
/* If no start node till now, this node is made as start node*/
if (start->next == NULL)
{
start.setNext(temp);
}
/* if start node exists, insert new node at end of list*/
else
{
s = start->next;
/* locating end of list*/
while (s->next != NULL)
{
s= s->next;
}
temp->next = NULL;
/* attaching new node */
s->next = temp;
cout<<"Element Inserted"<next->next != NULL)
{
s = s->next;
}
//After locating the end node
ptr=s->next;
s->next=NULL;
//deletting end node
return ptr;
}
}
//Prints elements of the list
void printContent()
{
struct node *ptr = start;
cout<data;
ptr=ptr->next;
}
}
}
//Prints total number of elements
int getSize()
{
struct node *ptr, *s;
int count=0;
if (start == NULL)
{
cout<<"The List is empty"<next;
count=1;
while (ptr != NULL)
{
count++;
ptr=ptr->next;
}
return count;
}
//Returns true if there is no element in the list.
bool empty()
{
if(start==NULL)
{
return empty;
}
}
};
Solution
#include
#include
using namespace std;
template class Node{
private:
T value;
Node *next;
public:
Node();
Node (T data);
T remove();
T getValue();
Node* getNext();
void setValue(T data);
void setNext(Node *nextNode);
};
template
Node::Node(){
T value =NULL;
}
template
Node::Node(T data){
T value=data;
}
template
T Node::getValue(){
return value;
}
template
Node* Node::getNext(){
return next;
}
template
void Node::setValue(T data){
T value=data;
}
template
void Node::setNext(Node *nextNode){
next=nextNode;
}
template class MyLinkedList{
Node start;
//Define a constructor
MyLinkedList()
{
start->setValue(0);
start->setNext(NULL);
}
//Member Functions:
// Adds a new element to the list
void add (T val)
{
/* creating a new node to hold value*/
Nodetemp(val,NULL);
/* If no start node till now, this node is made as start node*/
if (start->next == NULL)
{
start.setNext(temp);
}
/* if start node exists, insert new node at end of list*/
else
{
s = start->next;
/* locating end of list*/
while (s->next != NULL)
{
s= s->next;
}
temp->next = NULL;
/* attaching new node */
s->next = temp;
cout<<"Element Inserted"<next->next != NULL)
{
s = s->next;
}
//After locating the end node
ptr=s->next;
s->next=NULL;
//deletting end node
return ptr;
}
}
//Prints elements of the list
void printContent()
{
struct node *ptr = start;
cout<data;
ptr=ptr->next;
}
}
}
//Prints total number of elements
int getSize()
{
struct node *ptr, *s;
int count=0;
if (start == NULL)
{
cout<<"The List is empty"<next;
count=1;
while (ptr != NULL)
{
count++;
ptr=ptr->next;
}
return count;
}
//Returns true if there is no element in the list.
bool empty()
{
if(start==NULL)
{
return empty;
}
}
};

More Related Content

Similar to #include iostream #include cstddefusing namespace std;temp.pdf

Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfvishalateen
 
Below binary program is usefell to you#include iostreamtem.pdf
Below binary program is usefell to you#include iostreamtem.pdfBelow binary program is usefell to you#include iostreamtem.pdf
Below binary program is usefell to you#include iostreamtem.pdfanandinternational01
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3ecomputernotes
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxDIPESH30
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdffathimafancyjeweller
 
C code on linked list #include stdio.h #include stdlib.h.pdf
 C code on linked list #include stdio.h #include stdlib.h.pdf C code on linked list #include stdio.h #include stdlib.h.pdf
C code on linked list #include stdio.h #include stdlib.h.pdfdeepua8
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
 
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
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxteyaj1
 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdfalmaniaeyewear
 
#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdfharihelectronicspune
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docxajoy21
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfinfo114
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfAnkitchhabra28
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhvasavim9
 

Similar to #include iostream #include cstddefusing namespace std;temp.pdf (20)

Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
 
Below binary program is usefell to you#include iostreamtem.pdf
Below binary program is usefell to you#include iostreamtem.pdfBelow binary program is usefell to you#include iostreamtem.pdf
Below binary program is usefell to you#include iostreamtem.pdf
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3
 
Lab-2.4 101.pdf
Lab-2.4 101.pdfLab-2.4 101.pdf
Lab-2.4 101.pdf
 
dynamicList.ppt
dynamicList.pptdynamicList.ppt
dynamicList.ppt
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
Linked Stack program.docx
Linked Stack program.docxLinked Stack program.docx
Linked Stack program.docx
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
 
C code on linked list #include stdio.h #include stdlib.h.pdf
 C code on linked list #include stdio.h #include stdlib.h.pdf C code on linked list #include stdio.h #include stdlib.h.pdf
C code on linked list #include stdio.h #include stdlib.h.pdf
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
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
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docx
 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 
#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdf
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
 

More from karan8801

1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdfkaran8801
 
omparative historical research is a method of social science that e.pdf
 omparative historical research is a method of social science that e.pdf omparative historical research is a method of social science that e.pdf
omparative historical research is a method of social science that e.pdfkaran8801
 
1 .D 2.BSolution 1 .D 2.B.pdf
 1 .D 2.BSolution 1 .D 2.B.pdf 1 .D 2.BSolution 1 .D 2.B.pdf
1 .D 2.BSolution 1 .D 2.B.pdfkaran8801
 
where is it .pdf
                     where is it                                      .pdf                     where is it                                      .pdf
where is it .pdfkaran8801
 
The name of the reaction is aldol condesation (Cl.pdf
                     The name of the reaction is aldol condesation (Cl.pdf                     The name of the reaction is aldol condesation (Cl.pdf
The name of the reaction is aldol condesation (Cl.pdfkaran8801
 
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf
Step1 3 moles of H2O react with Cr metal = 2moles.pdfkaran8801
 
sp2 - sp2 .pdf
                     sp2 - sp2                                       .pdf                     sp2 - sp2                                       .pdf
sp2 - sp2 .pdfkaran8801
 
Part A neutralizes acids - base Part B produces.pdf
                     Part A neutralizes acids - base Part B produces.pdf                     Part A neutralizes acids - base Part B produces.pdf
Part A neutralizes acids - base Part B produces.pdfkaran8801
 
Lewis Acid Base Reaction .pdf
                     Lewis Acid Base Reaction                         .pdf                     Lewis Acid Base Reaction                         .pdf
Lewis Acid Base Reaction .pdfkaran8801
 
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdfkaran8801
 
It is a reaction for secondary amines .Option 2 i.pdf
                     It is a reaction for secondary amines .Option 2 i.pdf                     It is a reaction for secondary amines .Option 2 i.pdf
It is a reaction for secondary amines .Option 2 i.pdfkaran8801
 
fluorene is mobile phase and fluorenone is statio.pdf
                     fluorene is mobile phase and fluorenone is statio.pdf                     fluorene is mobile phase and fluorenone is statio.pdf
fluorene is mobile phase and fluorenone is statio.pdfkaran8801
 
equivalent mass is 27.9 . so Molecular massmole.pdf
                     equivalent mass is 27.9 .  so Molecular massmole.pdf                     equivalent mass is 27.9 .  so Molecular massmole.pdf
equivalent mass is 27.9 . so Molecular massmole.pdfkaran8801
 
There is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdfThere is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdfkaran8801
 
This is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdfThis is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdfkaran8801
 
d. 8 The bonding electrons are the electrons taki.pdf
                     d. 8 The bonding electrons are the electrons taki.pdf                     d. 8 The bonding electrons are the electrons taki.pdf
d. 8 The bonding electrons are the electrons taki.pdfkaran8801
 
The genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdfThe genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdfkaran8801
 
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdfThe corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdfkaran8801
 
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdfSince Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdfkaran8801
 
selected palntsxerophyte verus mesophyte========================.pdf
selected palntsxerophyte verus mesophyte========================.pdfselected palntsxerophyte verus mesophyte========================.pdf
selected palntsxerophyte verus mesophyte========================.pdfkaran8801
 

More from karan8801 (20)

1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
 
omparative historical research is a method of social science that e.pdf
 omparative historical research is a method of social science that e.pdf omparative historical research is a method of social science that e.pdf
omparative historical research is a method of social science that e.pdf
 
1 .D 2.BSolution 1 .D 2.B.pdf
 1 .D 2.BSolution 1 .D 2.B.pdf 1 .D 2.BSolution 1 .D 2.B.pdf
1 .D 2.BSolution 1 .D 2.B.pdf
 
where is it .pdf
                     where is it                                      .pdf                     where is it                                      .pdf
where is it .pdf
 
The name of the reaction is aldol condesation (Cl.pdf
                     The name of the reaction is aldol condesation (Cl.pdf                     The name of the reaction is aldol condesation (Cl.pdf
The name of the reaction is aldol condesation (Cl.pdf
 
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
 
sp2 - sp2 .pdf
                     sp2 - sp2                                       .pdf                     sp2 - sp2                                       .pdf
sp2 - sp2 .pdf
 
Part A neutralizes acids - base Part B produces.pdf
                     Part A neutralizes acids - base Part B produces.pdf                     Part A neutralizes acids - base Part B produces.pdf
Part A neutralizes acids - base Part B produces.pdf
 
Lewis Acid Base Reaction .pdf
                     Lewis Acid Base Reaction                         .pdf                     Lewis Acid Base Reaction                         .pdf
Lewis Acid Base Reaction .pdf
 
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
 
It is a reaction for secondary amines .Option 2 i.pdf
                     It is a reaction for secondary amines .Option 2 i.pdf                     It is a reaction for secondary amines .Option 2 i.pdf
It is a reaction for secondary amines .Option 2 i.pdf
 
fluorene is mobile phase and fluorenone is statio.pdf
                     fluorene is mobile phase and fluorenone is statio.pdf                     fluorene is mobile phase and fluorenone is statio.pdf
fluorene is mobile phase and fluorenone is statio.pdf
 
equivalent mass is 27.9 . so Molecular massmole.pdf
                     equivalent mass is 27.9 .  so Molecular massmole.pdf                     equivalent mass is 27.9 .  so Molecular massmole.pdf
equivalent mass is 27.9 . so Molecular massmole.pdf
 
There is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdfThere is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdf
 
This is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdfThis is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdf
 
d. 8 The bonding electrons are the electrons taki.pdf
                     d. 8 The bonding electrons are the electrons taki.pdf                     d. 8 The bonding electrons are the electrons taki.pdf
d. 8 The bonding electrons are the electrons taki.pdf
 
The genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdfThe genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdf
 
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdfThe corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
 
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdfSince Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
 
selected palntsxerophyte verus mesophyte========================.pdf
selected palntsxerophyte verus mesophyte========================.pdfselected palntsxerophyte verus mesophyte========================.pdf
selected palntsxerophyte verus mesophyte========================.pdf
 

Recently uploaded

An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsISCOPE Publication
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 

Recently uploaded (20)

An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS Publications
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 

#include iostream #include cstddefusing namespace std;temp.pdf

  • 1. #include #include using namespace std; template class Node{ private: T value; Node *next; public: Node(); Node (T data); T remove(); T getValue(); Node* getNext(); void setValue(T data); void setNext(Node *nextNode); }; template Node::Node(){ T value =NULL; } template Node::Node(T data){ T value=data; } template T Node::getValue(){ return value; } template Node* Node::getNext(){ return next; } template void Node::setValue(T data){ T value=data;
  • 2. } template void Node::setNext(Node *nextNode){ next=nextNode; } template class MyLinkedList{ Node start; //Define a constructor MyLinkedList() { start->setValue(0); start->setNext(NULL); } //Member Functions: // Adds a new element to the list void add (T val) { /* creating a new node to hold value*/ Nodetemp(val,NULL); /* If no start node till now, this node is made as start node*/ if (start->next == NULL) { start.setNext(temp); } /* if start node exists, insert new node at end of list*/ else { s = start->next; /* locating end of list*/ while (s->next != NULL) { s= s->next; } temp->next = NULL; /* attaching new node */
  • 3. s->next = temp; cout<<"Element Inserted"<next->next != NULL) { s = s->next; } //After locating the end node ptr=s->next; s->next=NULL; //deletting end node return ptr; } } //Prints elements of the list void printContent() { struct node *ptr = start; cout<data; ptr=ptr->next; } } } //Prints total number of elements int getSize() { struct node *ptr, *s; int count=0; if (start == NULL) { cout<<"The List is empty"<next; count=1; while (ptr != NULL) { count++; ptr=ptr->next; }
  • 4. return count; } //Returns true if there is no element in the list. bool empty() { if(start==NULL) { return empty; } } }; Solution #include #include using namespace std; template class Node{ private: T value; Node *next; public: Node(); Node (T data); T remove(); T getValue(); Node* getNext(); void setValue(T data); void setNext(Node *nextNode); }; template Node::Node(){ T value =NULL; }
  • 5. template Node::Node(T data){ T value=data; } template T Node::getValue(){ return value; } template Node* Node::getNext(){ return next; } template void Node::setValue(T data){ T value=data; } template void Node::setNext(Node *nextNode){ next=nextNode; } template class MyLinkedList{ Node start; //Define a constructor MyLinkedList() { start->setValue(0); start->setNext(NULL); } //Member Functions: // Adds a new element to the list void add (T val) { /* creating a new node to hold value*/ Nodetemp(val,NULL); /* If no start node till now, this node is made as start node*/
  • 6. if (start->next == NULL) { start.setNext(temp); } /* if start node exists, insert new node at end of list*/ else { s = start->next; /* locating end of list*/ while (s->next != NULL) { s= s->next; } temp->next = NULL; /* attaching new node */ s->next = temp; cout<<"Element Inserted"<next->next != NULL) { s = s->next; } //After locating the end node ptr=s->next; s->next=NULL; //deletting end node return ptr; } } //Prints elements of the list void printContent() { struct node *ptr = start; cout<data; ptr=ptr->next; } }
  • 7. } //Prints total number of elements int getSize() { struct node *ptr, *s; int count=0; if (start == NULL) { cout<<"The List is empty"<next; count=1; while (ptr != NULL) { count++; ptr=ptr->next; } return count; } //Returns true if there is no element in the list. bool empty() { if(start==NULL) { return empty; } } };