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

Consuming the DoublyLinkedList ADT

Since the LinkedList<T> and DoublyLinkedList<T> data types have the exact same operations, we can use the code in the main() function of the main.cpp file in the Singly_Linked_List.cbp project to consume the DoublyLinkedList data type. The code works like a charm when I try it, and produces the exact same output as the output of the Singly_Linked_List.cbp project. However, since we now have a PrintListBackward() method, here is the code to apply to the backward movement in the DoublyLinkedList data type:

// Project: Doubly_Linked_List.cbp// File : main.cpp#include <iostream>#include "DoublyNode.h"#include "DoublyLinkedList.h"using namespace std;int main(){    // NULL DoublyLinkedList<int> linkedList = DoublyLinkedList<int>(); ...
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