Maximum & Minimum Depth of Binary Tree | BFS & DFS Approach | LeetCode | C++, Java, Python

Published: 22 July 2026
on channel: RisingBrain
844
48

In this video, we solve the Maximum Depth and Minimum Depth of a Binary Tree using both BFS (Breadth First Search) and DFS (Depth First Search) approaches.

We will understand how to calculate the depth of a binary tree step by step and learn when to use BFS and DFS for tree-based problems.

Topics Covered:
Maximum Depth of Binary Tree
Minimum Depth of Binary Tree
BFS Approach
DFS Approach
Level Order Traversal
Recursive Tree Traversal
Step-by-step explanation
Time and Space Complexity
Solutions in C++, Java, and Python
Complexity:

Maximum Depth using DFS:
Time: O(N)
Space: O(H) — recursion stack

Maximum Depth using BFS:
Time: O(N)
Space: O(W) — queue

Minimum Depth using BFS:
Time: O(N)
Space: O(W)

Minimum Depth using DFS:
Time: O(N)
Space: O(H)

Where N is the number of nodes, H is the height of the tree, and W is the maximum width of the tree.

Perfect for DSA interviews, coding interviews, LeetCode preparation, and Binary Tree problem-solving.

Rising Brain (DSA Sheet):
https://www.risingbrain.org/sheet

Connect with me here:

LinkedIn –   / anjalikumari22  

Instagram –   / rbanjali.codes  

Twitter (X) – https://x.com/anjali1kumari?s=21


On this page of the site you can watch the video online Maximum & Minimum Depth of Binary Tree | BFS & DFS Approach | LeetCode | C++, Java, Python with a duration of hours minute second in good quality, which was uploaded by the user RisingBrain 22 July 2026, share the link with friends and acquaintances, this video has already been watched 844 times on youtube and it was liked by 48 viewers. Enjoy your viewing!