Data Structures & Algorithms in Python: Implementing Trees & Graphs

Expected Duration
Lesson Objectives
Course Number
Expertise Level


Explore implementing trees and graphs in Python in this 14-video, hands-on course that contains only labs. In this course, learners will use Python 3 and Jupyter Notebooks as their IDE (integrated development environment). In the course labs, you will implement a binary search, define a binary search tree, and use code functions to work with those data structures. Next, you will implement algorithms to traverse trees, including how to perform a breadth-first traversal and depth-first traversal of the tree. Continue by examining graph data structure, and implementing different representations of graphs in Python by using an abstract class for a graph to represent graphs as both an adjacency set and an adjacency matrix. You will implement algorithms to traverse such graphs, including a breadth-first traversal and a depth-first traversal. This course then demonstrates how to run a test to check its implementation. Finally, learners observe how to implement a topological sort for a specific type of graph which is both directed as well as acyclic.

Expected Duration (hours)

Lesson Objectives

Data Structures & Algorithms in Python: Implementing Trees & Graphs

  • discover the key concepts covered in this course
  • code a function to perform a binary search on a sorted array of elements
  • define the classes and functions required to implement a binary search tree
  • create functions to perform common BST operations such as lookup and finding the minimum and maximum values
  • write a function to perform a breadth first traversal of a BST
  • code functions to perform pre-order, in-order, and post-order traversals of a BST
  • define an abstract base class for a graph implementation and a vertex class with an adjacency set
  • implement an adjacency set representation for a graph
  • build a graph represented as an adjacency set and test out the functions defined to work with it
  • define a class to represent a graph in the form of an adjacency matrix
  • code a function to perform a breadth first traversal of a graph
  • write a function to traverse a graph in a depth first manner
  • implement a topological sort of a directed acyclic graph
  • list the three different forms of depth first traversal of a binary tree and describe the Topological Sort algorithm for a graph
  • Course Number:

    Expertise Level