SlideShare una empresa de Scribd logo
1 de 5
Descargar para leer sin conexión
C++ pleae
/// Your welcome
DoublyLinkedList()
{
this->head_ = nullptr;
this->tail_ = nullptr;
this->size_ = 0;
}
/// Copy Constructor
DoublyLinkedList(DoublyLinkedList& other)
{
for (auto it = other.begin(); it!= other.end(); ++it) {
this->push_back(*it);
}
}
/// DTOR: Your welcome
~DoublyLinkedList()
{
this->clear();
}
/**
* Clear the list and assign the same value, count times.
* If count was 5, T was int, and value was 3,
* we'd end up with a list like {3, 3, 3, 3, 3}
*/
void assign(size_t count, const T& value)
{
this->clear();
for (size_t i = 0; i < count; ++i) {
this->push_back(value);
}
}
/**
* Clear the list and assign values from another list.
* The 'first' iterator points to the first item copied from the other list.
* The 'last' iterator points to the last item copied from the other list.
*
* Example:
* Suppose we have a source list like {8, 4, 3, 2, 7, 1}
* Suppose first points to the 4
* Suppose last points to the 7
* We should end up with our list becoming: {4, 3, 2, 7}
*
* If the user code sends out-of-order iterators,
* just copy from 'first' to the end of the source list
* Example: first=7, last=4 from the list above would give us:
* {7, 1}
*/
void assign(Iterator first, Iterator last)
{
this->clear();
Iterator it;
for (it = first; it!= last; ++it) {
this->push_back(*it);
}
if (it != nullptr && it->next == last) {
this->push_back(*last);
}
}
/// Return a pointer to the head node, if any
Node<T>* head() { return head_; }
/// Return a pointer to the tail node, if any
Node<T>* tail() { return tail_; }
/**
* Return an iterator that points to the head of our list
*/
Iterator begin()
{
return Iterator(this->head_);
}
/**
* Return an iterator that points to the last element (tail) of our list
*/
Iterator last()
{
return Iterator(this->tail_);
}
/**
* Should return an iterator that represents being past the end of our nodes,
* or just that we are finished.
* You can make this a nullptr or use some other scheme of your choosing,
* as long as it works with the logic of the rest of your implementations.
*/
Iterator end()
{
return Iterator(nullptr);
}
/**
* Returns true if our list is empty
*/
bool empty() const
{
return this->size_ == 0;
}
/**
* Returns the current size of the list
* Should finish in constant time!
* (keep track of the size elsewhere)
*/
size_t size() const
{
return 0;
}
/**
* Clears our entire list, making it empty
* Remember: All removal operations should be memory-leak free.
*/
void clear()
{
size_ = 0;
Node<T> *node = this->head_;
while (node!= nullptr) {
Node<T> *next = node->next_;
delete node;
node = next;
}
this->head_ = nullptr;
this->tail_ = nullptr;
}
/**
* Insert an element after the node pointed to by the pos Iterator
*
* If the list is currently empty,
* ignore the iterator and just make the new node at the head/tail (list of length 1).
*
* If the incoming iterator is this->end(), insert the element at the tail
*
* Should return an iterator that points to the newly added node
*
* To avoid repeated code, it might be a good idea to have other methods
* rely on this one.
*/
Iterator insert_after(Iterator pos, const T& value)
{
return Iterator(nullptr, nullptr, nullptr);
}
/**
* Insert a new element after the index pos.
* Should work with an empty list.
*
* Should return an iterator pointing to the newly created node
*
* To reduce repeated code, you may want to simply find
* an iterator to the node at the pos index, then
* send it to the other overload of this method.
*/
Iterator insert_after(size_t pos, const T& value)
{
return Iterator(nullptr, nullptr, nullptr);
}
/**
* Erase the node pointed to by the Iterator's cursor.
*
* If the 'pos' iterator does not point to a valid node,
* throw an std::range_error
*
* Return an iterator to the node AFTER the one we erased,
* or this->end() if we just erased the tail
*/
Iterator erase(Iterator pos)
{
return Iterator(nullptr, nullptr, nullptr);
}
/**
* Add an element just after the one pointed to by the 'pos' iterator
*
* Should return an iterator pointing to the newly created node
*/
Iterator push_after(Iterator pos, const T& value)
{
return Iterator(nullptr, nullptr, nullptr);
}
/**
* Add a new element to the front of our list.
*/
void push_front(const T& value)
{
}
/**
* Add an element to the end of this list.
*
* Should return an iterator pointing to the newly created node.
*/
Iterator push_back(const T& value)
{
Node<T> *new_node = new Node<T>(value, nullptr, tail_);
if (tail_ == nullptr) {
head_ = new_node;
} else {
tail_->setNext(new_node);
}
tail_ = new_node;
++size_;
return Iterator(new_node, head_, tail_);
}
/**
* Remove the node at the front of our list
*
* Should throw an exception if our list is empty
*/
void pop_front()
{
}

Más contenido relacionado

Similar a C++ pleae Your welcome DoublyLinkedList thisgthea.pdf

--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
AdrianEBJKingr
 
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
fmac5
 
Please fix my errors class Iterator public Construc.pdf
Please fix my errors   class Iterator  public  Construc.pdfPlease fix my errors   class Iterator  public  Construc.pdf
Please fix my errors class Iterator public Construc.pdf
kitty811
 
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
vishalateen
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
seoagam1
 
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
BANSALANKIT1077
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
mail931892
 
For this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docxFor this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docx
mckellarhastings
 
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
ankit11134
 
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
flashfashioncasualwe
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
clearvisioneyecareno
 
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdfCopy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
facevenky
 
This is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdfThis is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdf
fcaindore
 
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
EricvtJFraserr
 
template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdf
ashokadyes
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
fantoosh1
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
poblettesedanoree498
 
for initializer_list include ltinitializer_listgt .pdf
 for initializer_list include ltinitializer_listgt .pdf for initializer_list include ltinitializer_listgt .pdf
for initializer_list include ltinitializer_listgt .pdf
ajay1317
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
malavshah9013
 
Use C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdfUse C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdf
shalins6
 

Similar a C++ pleae Your welcome DoublyLinkedList thisgthea.pdf (20)

--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf--INSTRUCTION- --It helps to first create if-then-else structure to fi.pdf
--INSTRUCTION- --It helps to first create if-then-else structure to fi.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.pdf
 
Please fix my errors class Iterator public Construc.pdf
Please fix my errors   class Iterator  public  Construc.pdfPlease fix my errors   class Iterator  public  Construc.pdf
Please fix my errors class Iterator public Construc.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-.pdf
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
 
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
#include -algorithm- #include -cstdlib- #include -iostream- #include -.pdf
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
 
For this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docxFor this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docx
 
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
 
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
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
 
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdfCopy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
 
This is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdfThis is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.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
 
template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdf
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
for initializer_list include ltinitializer_listgt .pdf
 for initializer_list include ltinitializer_listgt .pdf for initializer_list include ltinitializer_listgt .pdf
for initializer_list include ltinitializer_listgt .pdf
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
 
Use C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdfUse C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdf
 

Más de jaipur2

Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdf
jaipur2
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdf
jaipur2
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdf
jaipur2
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdf
jaipur2
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdf
jaipur2
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
jaipur2
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
jaipur2
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
jaipur2
 

Más de jaipur2 (20)

Business inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdfBusiness inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdf
 
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdfBu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
 
BU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdfBU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdf
 
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdfBu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdf
 
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdfBu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
 
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdfBu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
 
Bullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdfBullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdf
 
Bulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdfBulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdf
 
Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdf
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdf
 
C++ only plz Write a function that takes two arguments and .pdf
C++ only  plz Write a function that takes two arguments and .pdfC++ only  plz Write a function that takes two arguments and .pdf
C++ only plz Write a function that takes two arguments and .pdf
 
C++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfC++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdf
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdf
 
C++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfC++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdf
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdf
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdf
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
 
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfBu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
 

Último

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (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
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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 ...
 
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
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
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
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

C++ pleae Your welcome DoublyLinkedList thisgthea.pdf

  • 1. C++ pleae /// Your welcome DoublyLinkedList() { this->head_ = nullptr; this->tail_ = nullptr; this->size_ = 0; } /// Copy Constructor DoublyLinkedList(DoublyLinkedList& other) { for (auto it = other.begin(); it!= other.end(); ++it) { this->push_back(*it); } } /// DTOR: Your welcome ~DoublyLinkedList() { this->clear(); } /** * Clear the list and assign the same value, count times. * If count was 5, T was int, and value was 3, * we'd end up with a list like {3, 3, 3, 3, 3} */ void assign(size_t count, const T& value) { this->clear(); for (size_t i = 0; i < count; ++i) { this->push_back(value); } } /** * Clear the list and assign values from another list. * The 'first' iterator points to the first item copied from the other list. * The 'last' iterator points to the last item copied from the other list. * * Example: * Suppose we have a source list like {8, 4, 3, 2, 7, 1} * Suppose first points to the 4 * Suppose last points to the 7 * We should end up with our list becoming: {4, 3, 2, 7}
  • 2. * * If the user code sends out-of-order iterators, * just copy from 'first' to the end of the source list * Example: first=7, last=4 from the list above would give us: * {7, 1} */ void assign(Iterator first, Iterator last) { this->clear(); Iterator it; for (it = first; it!= last; ++it) { this->push_back(*it); } if (it != nullptr && it->next == last) { this->push_back(*last); } } /// Return a pointer to the head node, if any Node<T>* head() { return head_; } /// Return a pointer to the tail node, if any Node<T>* tail() { return tail_; } /** * Return an iterator that points to the head of our list */ Iterator begin() { return Iterator(this->head_); } /** * Return an iterator that points to the last element (tail) of our list */ Iterator last() { return Iterator(this->tail_); } /** * Should return an iterator that represents being past the end of our nodes, * or just that we are finished. * You can make this a nullptr or use some other scheme of your choosing, * as long as it works with the logic of the rest of your implementations. */ Iterator end()
  • 3. { return Iterator(nullptr); } /** * Returns true if our list is empty */ bool empty() const { return this->size_ == 0; } /** * Returns the current size of the list * Should finish in constant time! * (keep track of the size elsewhere) */ size_t size() const { return 0; } /** * Clears our entire list, making it empty * Remember: All removal operations should be memory-leak free. */ void clear() { size_ = 0; Node<T> *node = this->head_; while (node!= nullptr) { Node<T> *next = node->next_; delete node; node = next; } this->head_ = nullptr; this->tail_ = nullptr; } /** * Insert an element after the node pointed to by the pos Iterator * * If the list is currently empty, * ignore the iterator and just make the new node at the head/tail (list of length 1). * * If the incoming iterator is this->end(), insert the element at the tail
  • 4. * * Should return an iterator that points to the newly added node * * To avoid repeated code, it might be a good idea to have other methods * rely on this one. */ Iterator insert_after(Iterator pos, const T& value) { return Iterator(nullptr, nullptr, nullptr); } /** * Insert a new element after the index pos. * Should work with an empty list. * * Should return an iterator pointing to the newly created node * * To reduce repeated code, you may want to simply find * an iterator to the node at the pos index, then * send it to the other overload of this method. */ Iterator insert_after(size_t pos, const T& value) { return Iterator(nullptr, nullptr, nullptr); } /** * Erase the node pointed to by the Iterator's cursor. * * If the 'pos' iterator does not point to a valid node, * throw an std::range_error * * Return an iterator to the node AFTER the one we erased, * or this->end() if we just erased the tail */ Iterator erase(Iterator pos) { return Iterator(nullptr, nullptr, nullptr); } /** * Add an element just after the one pointed to by the 'pos' iterator * * Should return an iterator pointing to the newly created node */
  • 5. Iterator push_after(Iterator pos, const T& value) { return Iterator(nullptr, nullptr, nullptr); } /** * Add a new element to the front of our list. */ void push_front(const T& value) { } /** * Add an element to the end of this list. * * Should return an iterator pointing to the newly created node. */ Iterator push_back(const T& value) { Node<T> *new_node = new Node<T>(value, nullptr, tail_); if (tail_ == nullptr) { head_ = new_node; } else { tail_->setNext(new_node); } tail_ = new_node; ++size_; return Iterator(new_node, head_, tail_); } /** * Remove the node at the front of our list * * Should throw an exception if our list is empty */ void pop_front() { }