Find Height of a Binary Tree (Algo + Code + Complexity)

Описание к видео Find Height of a Binary Tree (Algo + Code + Complexity)

This video will show you how to find the height of a binary tree.

We will first go through the algorithm, then write the code, and finally, analyze the time and space complexity.

What is the height of a binary tree?

The height of a binary tree is the largest number of edges in a path from the root node to a leaf node.

How can we find it?

The algorithm to find the height is very simple: we start at the root node and find the height of the left subtree, then the height of the right subtree, and finally, we return the maximum of the two heights plus one.

You can find the C++ code for the height function shown in the video by going to cs.phyley.com/binary-tree/find-height

Комментарии

Информация по комментариям в разработке