Source Code:https://thecodingsimplified.com/find-depth-of-odd-level-leaf-node-in-binary-tree/
Solution:
- We'll take variable depthDeepestOldLevel
- We'll traverse Binary Tree in Pre Order manner starting with level 1 & when we're moving left or right, we'll increase this variable 'level' by one
- Whenever we find Leaf node, we'll check if it's odd level, then update depthDeepestOldLevel with this value
- Time Complexity: O(n)
- Space Complexity: O(1)
Do Watch video for more info
This Problem is synonym of following problems:
binary tree Find deepest Odd level which contains Leaf node,
Find deepest Odd level which contains Leaf node in Binary Tree,
coding simplified
CHECK OUT CODING SIMPLIFIED
https://www.youtube.com/codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com
I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 200+ videos.
★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplified?sub_confirmation=1
★☆★ Send us mail at: ★☆★
Email: [email protected]
Download
0 formats
No download links available.
Binary Tree - 55: Find deepest Odd level which contains Leaf node in Binary Tree | NatokHD