2. Trees, Heaps, and Graphs

Learning Objectives

By the end of this chapter, you will be able to:

  • Analyze and identify where non-linear data structures can be used
  • Implement and manipulate tree structures to represent data and solve problems
  • Traverse a tree using various methods
  • Implement a graph structure to represent data and solve problems
  • Represent a graph using different methods based on a given scenario

In this chapter, we will look at two non-linear data structures, namely trees and graphs, and how they can be used to represent real-world scenarios and solve various problems.

Introduction

In the previous chapter, we implemented different types of linear data structures to store and manage data in a linear fashion. In linear structures, ...

Get C++ Data Structures and Algorithm Design Principles 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.