Skip to Content
C++ Data Structures and Algorithms
book

C++ Data Structures and Algorithms

by Wisnu Anggoro
April 2018
Intermediate to advanced content levelIntermediate to advanced
322 pages
6h 57m
English
Packt Publishing
Content preview from C++ Data Structures and Algorithms

std::list

C++ has a built-in template class that implements the Doubly Linked List. Since then, it also contains all of the operations that the DoublyLinkedList data type has. Don't forget to include the list header at the beginning of code file if we are going to use the std::list data type. The usage of the iterator is also the same as the vector data type. We will refactor our code in the main.cpp file of the Doubly_Linked_List.cbp project so that we can use the list data type. The code should be as follows:

int main(){    // Initialize a linked list    list<int> linkedList;    // 43->NULL    linkedList.push_front(43);    // 76->43->NULL    linkedList.push_front(76);    // 76->43->15->NULL    linkedList.push_back(15);    // 76->43->15->44->NULL linkedList.push_back(44); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures and Algorithms Using C++

Data Structures and Algorithms Using C++

Ananda Rao Akepogu, Radhika Raju Palagiri
C++ Data Structures and Algorithm Design Principles

C++ Data Structures and Algorithm Design Principles

John Carey, Anil Achary, Shreyans Doshi, Payas Rajan
C++ Plus Data Structures, 6th Edition

C++ Plus Data Structures, 6th Edition

Nell Dale, Chip Weems, Tim Richards

Publisher Resources

ISBN: 9781788835213Supplemental Content