Swift Programming Algorithm & Data Structure - Find Maximum Binary Tree Depth

preview_player
Показать описание
I love the Swift programming language. In this channel, I will showcase anything that I am building or solving via the Swift programming language.

In this video, I have attempted to solve an algorithm / data structure question. The question is to find maximum binary tree depth.

In this video you'll watch my take on how I solve this problem:

1. Start of by creating a TreeNode class

2. Created a class to calculate the depth of the TreeNode

3. The solution here is to traverse the nodes via recursion technique and increment the count by 1 each time a traverse happens

4. At the end we would compare the depth between left and right node. With the max function we would know which summation of the left and right node is higher.

5. I went on to show what happens when we add / remove an extra node to show that the depth would be increased / decrease to prove that the logic is expected.

Hope this video is helpful! Would be looking forward to upload more videos relating to me attempting to solve some Algorithm and Data Structure questions in my current favourite language, Swift. Will try to ramp up production quality as time comes. =]

#swiftprogramming #swiftalgorithm #swiftdatastructures
Рекомендации по теме
Комментарии
Автор

Here's a video of me attempting to find the maximum depth of a binary tree.

ESwift