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 LinkedList ADT

Now, it's time to consume our new LinkedList data type in our code. We can use all of the operations of the data type. We will try to initialize a new LinkedList, add several items, and then invoke the Get(), Insert(), Search(), and Remove() operations. Don't worry about invoking these operations in a specific order; as long as we have instantiated the LinkedList object, everything will work since we have restricted the out of bound index problem. Without further ado, here's the code:

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