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>(); ...

Get C++ Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.