Back to Browse

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

45.9K views
Apr 12, 2018
10:46

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

Download

1 formats

Video Formats

360pmp412.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

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