SlideShare una empresa de Scribd logo
1 de 4
To support this add the following functions to each of DList and Sentinel classes:
These functions returns an iterator/const_iterator to the first node in the list, end() if list is empty.
these functions returns an iterator/const_iterator to the node just after the last node in the linked
list.
Iterator/const_iterator classes
The const_iterator and iterators must support the following operations:
iterator advances to next node in list if iterator is not currently at end(). The iterator returned
depends if it is prefix or postfix. prefix operator returns iterator to current node. postfix operator
returns iterator to node before the increment.
iterator refer to the node "previous" to the linked list. The iterator returned depends if it is prefix
or postfix. prefix operator returns iterator to current node. postfix operator returns iterator to
node before the decrement.
returns a const reference to data in the node referred to by the iterator.
returns a reference to data in the node referred to by the iterator.
Please implement iterator and const_iterator for both the functions DList and Sentinel classes
in C++ code language , thank you!
#include
<iostream>
template <typename T>
class DList{
struct Node{
T data_;
Node* next_;
Node* prev_;
Node(const T& data=T{},Node* next=nullptr, Node* prev=nullptr){
data_=data;
next_=next;
prev_=prev;
}
};
Node* front_;
Node* back_;
public:
DList(){
front_=nullptr;
back_=nullptr;
}
void push_front(const T& data);
~DList();
class const_iterator{
Node* curr_;
const_iterator(Node* n){
curr_=n;
}
public:
const_iterator(){
curr_=nullptr;
}
const_iterator& operator++(){}
const_iterator operator++(int){}
const_iterator& operator--(){}
const_iterator operator--(int){}
bool operator==(const_iterator rhs){}
bool operator!=(const_iterator rhs){}
const T& operator*()const{}
};
class iterator:public const_iterator{
public:
iterator();
iterator& operator++(){}
iterator operator++(int){}
iterator& operator--(){}
iterator operator--(int){}
T& operator*(){}
const T& operator*()const{}
};
const_iterator cbegin() const{ }
iterator begin(){ }
const_iterator cend() const{}
iterator end(){}
};
template <typename T>
void DList<T>::push_front(const T& data){
}
template <typename T>
DList<T>::~DList(){
}
template <typename T>
class Sentinel{
struct Node{
T data_;
Node* next_;
Node* prev_;
Node(const T& data=T{},Node* next=nullptr, Node* prev=nullptr){
data_=data;
next_=next;
prev_=prev;
}
};
Node* front_;
Node* back_;
public:
Sentinel(){
front_=new Node();
back_=new Node();
front_->next_=back_;
back_->prev_=front_;
}
void push_front(const T& data);
~Sentinel();
class const_iterator{
public:
const_iterator(){}
const_iterator& operator++(){}
const_iterator operator++(int){}
const_iterator& operator--(){}
const_iterator operator--(int){}
bool operator==(const_iterator rhs){}
bool operator!=(const_iterator rhs){}
const T& operator*()const{}
};
class iterator:public const_iterator{
public:
iterator();
iterator& operator++(){}
iterator operator++(int){}
iterator& operator--(){}
iterator operator--(int){}
T& operator*(){}
const T& operator*()const{}
};
const_iterator cbegin() const{}
iterator begin(){}
const_iterator cend() const{}
iterator end(){}
};
template <typename T>
void Sentinel<T>::push_front(const T& data){
}
template <typename T>
Sentinel<T>::~Sentinel(){
}

Más contenido relacionado

Similar a To support this add the following functions to each of DList and Senti.docx

C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answerlavparmar007
 
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
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfcallawaycorb73779
 
SeriesTester.classpathSeriesTester.project SeriesT.docx
SeriesTester.classpathSeriesTester.project  SeriesT.docxSeriesTester.classpathSeriesTester.project  SeriesT.docx
SeriesTester.classpathSeriesTester.project SeriesT.docxlesleyryder69361
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxBrianGHiNewmanv
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfaathmiboutique
 
All About ... Functions
All About ... FunctionsAll About ... Functions
All About ... FunctionsMichal Bigos
 
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdfNeed Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdfEdwardw5nSlaterl
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfstopgolook
 
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdfPlease code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdffarankureshi
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfEricvtJFraserr
 
Consider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdfConsider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdfsales98
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfcontact41
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxShashiShash2
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfankit11134
 

Similar a To support this add the following functions to each of DList and Senti.docx (20)

C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
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
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
 
C1320prespost
C1320prespostC1320prespost
C1320prespost
 
SeriesTester.classpathSeriesTester.project SeriesT.docx
SeriesTester.classpathSeriesTester.project  SeriesT.docxSeriesTester.classpathSeriesTester.project  SeriesT.docx
SeriesTester.classpathSeriesTester.project SeriesT.docx
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docx
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
 
All About ... Functions
All About ... FunctionsAll About ... Functions
All About ... Functions
 
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdfNeed Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
 
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdfPlease code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
 
Consider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdfConsider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdf
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
Overloading
OverloadingOverloading
Overloading
 
Savitch ch 18
Savitch ch 18Savitch ch 18
Savitch ch 18
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdf
 

Más de jobesshirley

Use the magnitudes (Richter scale) of the earthquakes listed in the da.docx
Use the magnitudes (Richter scale) of the earthquakes listed in the da.docxUse the magnitudes (Richter scale) of the earthquakes listed in the da.docx
Use the magnitudes (Richter scale) of the earthquakes listed in the da.docxjobesshirley
 
Use the joint distribution of random variables X and Y to compute P(X-.docx
Use the joint distribution of random variables X and Y to compute P(X-.docxUse the joint distribution of random variables X and Y to compute P(X-.docx
Use the joint distribution of random variables X and Y to compute P(X-.docxjobesshirley
 
Use the image below to answer questions 2-3- As part of his series of.docx
Use the image below to answer questions 2-3- As part of his series of.docxUse the image below to answer questions 2-3- As part of his series of.docx
Use the image below to answer questions 2-3- As part of his series of.docxjobesshirley
 
Use the following figure to answer the question- The figurolshows the.docx
Use the following figure to answer the question- The figurolshows the.docxUse the following figure to answer the question- The figurolshows the.docx
Use the following figure to answer the question- The figurolshows the.docxjobesshirley
 
Use the drop-down menu to indicate if each element is a part of APA St.docx
Use the drop-down menu to indicate if each element is a part of APA St.docxUse the drop-down menu to indicate if each element is a part of APA St.docx
Use the drop-down menu to indicate if each element is a part of APA St.docxjobesshirley
 
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docx
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docxUse the figure below to answer questions 1-7- Nodes on this tree areAp.docx
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docxjobesshirley
 
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docx
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docxUse Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docx
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docxjobesshirley
 
Use Figure p7-1 for the following questions 1- Write the SQL code re.docx
Use Figure p7-1 for the following questions   1- Write the SQL code re.docxUse Figure p7-1 for the following questions   1- Write the SQL code re.docx
Use Figure p7-1 for the following questions 1- Write the SQL code re.docxjobesshirley
 
urrent Attempt in Progress Identify which of the following statements.docx
urrent Attempt in Progress Identify which of the following statements.docxurrent Attempt in Progress Identify which of the following statements.docx
urrent Attempt in Progress Identify which of the following statements.docxjobesshirley
 
Under what conditions would the cash method of accounting be advantage.docx
Under what conditions would the cash method of accounting be advantage.docxUnder what conditions would the cash method of accounting be advantage.docx
Under what conditions would the cash method of accounting be advantage.docxjobesshirley
 
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docx
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docxU-S- Senate-The file Senate113-txt contains the members of the 113 th.docx
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docxjobesshirley
 
Undertaking FDI- by definition- means not investing in the MNE's home.docx
Undertaking FDI- by definition- means not investing in the MNE's home.docxUndertaking FDI- by definition- means not investing in the MNE's home.docx
Undertaking FDI- by definition- means not investing in the MNE's home.docxjobesshirley
 
Two parents are carriers for the sickle cell trait- which exhibits cla.docx
Two parents are carriers for the sickle cell trait- which exhibits cla.docxTwo parents are carriers for the sickle cell trait- which exhibits cla.docx
Two parents are carriers for the sickle cell trait- which exhibits cla.docxjobesshirley
 
Two Types of Data for Constructing Trees There are two major different.docx
Two Types of Data for Constructing Trees There are two major different.docxTwo Types of Data for Constructing Trees There are two major different.docx
Two Types of Data for Constructing Trees There are two major different.docxjobesshirley
 
Two public corporations- First Engineering and Midwest Development- ea.docx
Two public corporations- First Engineering and Midwest Development- ea.docxTwo public corporations- First Engineering and Midwest Development- ea.docx
Two public corporations- First Engineering and Midwest Development- ea.docxjobesshirley
 
Two major components make up cell membranes- molecul.docx
Two major components make up cell membranes-                   molecul.docxTwo major components make up cell membranes-                   molecul.docx
Two major components make up cell membranes- molecul.docxjobesshirley
 
Two international banks are integrating two financial processing softw (2).docx
Two international banks are integrating two financial processing softw (2).docxTwo international banks are integrating two financial processing softw (2).docx
Two international banks are integrating two financial processing softw (2).docxjobesshirley
 
Two independent simple random samples are taken to test the difference.docx
Two independent simple random samples are taken to test the difference.docxTwo independent simple random samples are taken to test the difference.docx
Two independent simple random samples are taken to test the difference.docxjobesshirley
 
Tummy Foods purchased a two-year fire and extended coverage insurance.docx
Tummy Foods purchased a two-year fire and extended coverage insurance.docxTummy Foods purchased a two-year fire and extended coverage insurance.docx
Tummy Foods purchased a two-year fire and extended coverage insurance.docxjobesshirley
 
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docx
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docxTTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docx
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docxjobesshirley
 

Más de jobesshirley (20)

Use the magnitudes (Richter scale) of the earthquakes listed in the da.docx
Use the magnitudes (Richter scale) of the earthquakes listed in the da.docxUse the magnitudes (Richter scale) of the earthquakes listed in the da.docx
Use the magnitudes (Richter scale) of the earthquakes listed in the da.docx
 
Use the joint distribution of random variables X and Y to compute P(X-.docx
Use the joint distribution of random variables X and Y to compute P(X-.docxUse the joint distribution of random variables X and Y to compute P(X-.docx
Use the joint distribution of random variables X and Y to compute P(X-.docx
 
Use the image below to answer questions 2-3- As part of his series of.docx
Use the image below to answer questions 2-3- As part of his series of.docxUse the image below to answer questions 2-3- As part of his series of.docx
Use the image below to answer questions 2-3- As part of his series of.docx
 
Use the following figure to answer the question- The figurolshows the.docx
Use the following figure to answer the question- The figurolshows the.docxUse the following figure to answer the question- The figurolshows the.docx
Use the following figure to answer the question- The figurolshows the.docx
 
Use the drop-down menu to indicate if each element is a part of APA St.docx
Use the drop-down menu to indicate if each element is a part of APA St.docxUse the drop-down menu to indicate if each element is a part of APA St.docx
Use the drop-down menu to indicate if each element is a part of APA St.docx
 
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docx
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docxUse the figure below to answer questions 1-7- Nodes on this tree areAp.docx
Use the figure below to answer questions 1-7- Nodes on this tree areAp.docx
 
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docx
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docxUse Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docx
Use Table 1 in Appendix to find the following- a) P(X-12) for n-20-p-0.docx
 
Use Figure p7-1 for the following questions 1- Write the SQL code re.docx
Use Figure p7-1 for the following questions   1- Write the SQL code re.docxUse Figure p7-1 for the following questions   1- Write the SQL code re.docx
Use Figure p7-1 for the following questions 1- Write the SQL code re.docx
 
urrent Attempt in Progress Identify which of the following statements.docx
urrent Attempt in Progress Identify which of the following statements.docxurrent Attempt in Progress Identify which of the following statements.docx
urrent Attempt in Progress Identify which of the following statements.docx
 
Under what conditions would the cash method of accounting be advantage.docx
Under what conditions would the cash method of accounting be advantage.docxUnder what conditions would the cash method of accounting be advantage.docx
Under what conditions would the cash method of accounting be advantage.docx
 
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docx
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docxU-S- Senate-The file Senate113-txt contains the members of the 113 th.docx
U-S- Senate-The file Senate113-txt contains the members of the 113 th.docx
 
Undertaking FDI- by definition- means not investing in the MNE's home.docx
Undertaking FDI- by definition- means not investing in the MNE's home.docxUndertaking FDI- by definition- means not investing in the MNE's home.docx
Undertaking FDI- by definition- means not investing in the MNE's home.docx
 
Two parents are carriers for the sickle cell trait- which exhibits cla.docx
Two parents are carriers for the sickle cell trait- which exhibits cla.docxTwo parents are carriers for the sickle cell trait- which exhibits cla.docx
Two parents are carriers for the sickle cell trait- which exhibits cla.docx
 
Two Types of Data for Constructing Trees There are two major different.docx
Two Types of Data for Constructing Trees There are two major different.docxTwo Types of Data for Constructing Trees There are two major different.docx
Two Types of Data for Constructing Trees There are two major different.docx
 
Two public corporations- First Engineering and Midwest Development- ea.docx
Two public corporations- First Engineering and Midwest Development- ea.docxTwo public corporations- First Engineering and Midwest Development- ea.docx
Two public corporations- First Engineering and Midwest Development- ea.docx
 
Two major components make up cell membranes- molecul.docx
Two major components make up cell membranes-                   molecul.docxTwo major components make up cell membranes-                   molecul.docx
Two major components make up cell membranes- molecul.docx
 
Two international banks are integrating two financial processing softw (2).docx
Two international banks are integrating two financial processing softw (2).docxTwo international banks are integrating two financial processing softw (2).docx
Two international banks are integrating two financial processing softw (2).docx
 
Two independent simple random samples are taken to test the difference.docx
Two independent simple random samples are taken to test the difference.docxTwo independent simple random samples are taken to test the difference.docx
Two independent simple random samples are taken to test the difference.docx
 
Tummy Foods purchased a two-year fire and extended coverage insurance.docx
Tummy Foods purchased a two-year fire and extended coverage insurance.docxTummy Foods purchased a two-year fire and extended coverage insurance.docx
Tummy Foods purchased a two-year fire and extended coverage insurance.docx
 
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docx
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docxTTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docx
TTYL Corp expects 2021 sales to be $125 million- In 2020- TTYL had $11.docx
 

Último

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 

Último (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 

To support this add the following functions to each of DList and Senti.docx

  • 1. To support this add the following functions to each of DList and Sentinel classes: These functions returns an iterator/const_iterator to the first node in the list, end() if list is empty. these functions returns an iterator/const_iterator to the node just after the last node in the linked list. Iterator/const_iterator classes The const_iterator and iterators must support the following operations: iterator advances to next node in list if iterator is not currently at end(). The iterator returned depends if it is prefix or postfix. prefix operator returns iterator to current node. postfix operator returns iterator to node before the increment. iterator refer to the node "previous" to the linked list. The iterator returned depends if it is prefix or postfix. prefix operator returns iterator to current node. postfix operator returns iterator to node before the decrement. returns a const reference to data in the node referred to by the iterator. returns a reference to data in the node referred to by the iterator. Please implement iterator and const_iterator for both the functions DList and Sentinel classes in C++ code language , thank you! #include <iostream> template <typename T> class DList{ struct Node{ T data_; Node* next_; Node* prev_; Node(const T& data=T{},Node* next=nullptr, Node* prev=nullptr){ data_=data; next_=next; prev_=prev; } }; Node* front_; Node* back_; public:
  • 2. DList(){ front_=nullptr; back_=nullptr; } void push_front(const T& data); ~DList(); class const_iterator{ Node* curr_; const_iterator(Node* n){ curr_=n; } public: const_iterator(){ curr_=nullptr; } const_iterator& operator++(){} const_iterator operator++(int){} const_iterator& operator--(){} const_iterator operator--(int){} bool operator==(const_iterator rhs){} bool operator!=(const_iterator rhs){} const T& operator*()const{} }; class iterator:public const_iterator{ public: iterator(); iterator& operator++(){} iterator operator++(int){} iterator& operator--(){} iterator operator--(int){} T& operator*(){} const T& operator*()const{} }; const_iterator cbegin() const{ } iterator begin(){ } const_iterator cend() const{} iterator end(){}
  • 3. }; template <typename T> void DList<T>::push_front(const T& data){ } template <typename T> DList<T>::~DList(){ } template <typename T> class Sentinel{ struct Node{ T data_; Node* next_; Node* prev_; Node(const T& data=T{},Node* next=nullptr, Node* prev=nullptr){ data_=data; next_=next; prev_=prev; } }; Node* front_; Node* back_; public: Sentinel(){ front_=new Node(); back_=new Node(); front_->next_=back_; back_->prev_=front_; } void push_front(const T& data); ~Sentinel(); class const_iterator{ public: const_iterator(){} const_iterator& operator++(){} const_iterator operator++(int){} const_iterator& operator--(){}
  • 4. const_iterator operator--(int){} bool operator==(const_iterator rhs){} bool operator!=(const_iterator rhs){} const T& operator*()const{} }; class iterator:public const_iterator{ public: iterator(); iterator& operator++(){} iterator operator++(int){} iterator& operator--(){} iterator operator--(int){} T& operator*(){} const T& operator*()const{} }; const_iterator cbegin() const{} iterator begin(){} const_iterator cend() const{} iterator end(){} }; template <typename T> void Sentinel<T>::push_front(const T& data){ } template <typename T> Sentinel<T>::~Sentinel(){ }