Level-Order Traversal

In this lesson, you will learn how to implement level-order traversal of a binary tree in Python.

We'll cover the following...

In this lesson, we go over how to perform a level-order traversal in a binary tree. We then code a solution in Python building upon our binary tree class.

Here is an example of a level-order traversal:

Algorithm

To do a level-order traversal of a binary tree, we require a queue. Have a look at the slides below for the algorithm:

Implementation

Now that you are familiar with the algorithm, let’s jump to the implementation in Python. First, we’ll ...

Access this course and 1400+ top-rated courses and projects.