Тёмный

Binary Tree - 45: Print Root To Leaf Every Path In Binary Tree 

Coding Simplified
Подписаться 43 тыс.
Просмотров 20 тыс.
50% 1

Source Code:thecodingsimpl...
Solution:
- We'll keep on adding the node value in array & whenever there is leaf node, we'll print the array starting from 0 to current index
- Time Complexity: O(n)
- Space Complexity: O(n)
This Problem is synonym of following problems:
binary tree print every path from root to leaf,
print root to leaf path in binary tree,
coding simplified
Please check video for more info:
CHECK OUT CODING SIMPLIFIED
/ codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
thecodingsimpli...
I started my RU-vid channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 200+ videos.
★☆★ SUBSCRIBE TO ME ON RU-vid: ★☆★
www.youtube.co...
☆★ Send us mail at: ★☆★
Email: thecodingsimplified@gmail.com

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@sivaganesh4489
@sivaganesh4489 4 года назад
Most underrated channel
@CodingSimplified
@CodingSimplified 4 года назад
Thanks. Please share the channel content with your friends.
@sivaganesh4489
@sivaganesh4489 4 года назад
@@CodingSimplified defently already suggested your binary tree playlist to many of my friends please do more videos
@CodingSimplified
@CodingSimplified 4 года назад
@@sivaganesh4489 Thanks.
@upendrachauhan5260
@upendrachauhan5260 Месяц назад
do not waste your time by watching this video
@jabedakhtar5156
@jabedakhtar5156 4 года назад
wish I could know this channel before ❤️ lovely explanation brother ❤️
@CodingSimplified
@CodingSimplified 4 года назад
Thanks for your nice feedback. Keep Watching.
@sojanmathew5875
@sojanmathew5875 3 года назад
How about using stack instead of array? (no need to manage index). If ( node is leaf) { print stack; pop node; return}
@ShreyaSingh-vr9qi
@ShreyaSingh-vr9qi 4 года назад
How we can solve this problem using iteration ??
@CodingSimplified
@CodingSimplified 4 года назад
Here we're solving via preorder. You can take a cue from following video, where we're executing preorder without recursion. : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qv1nLlk5LEU.html
@tastaslim
@tastaslim 4 года назад
Easily using Iterative preorder and a map to have a check of nodes visited or not.
@soumavanag5025
@soumavanag5025 3 года назад
thank you very much :)
@CodingSimplified
@CodingSimplified 3 года назад
Thanks for your nice feedback. Keep Watching.
@selvalooks
@selvalooks 4 года назад
cool , i had the solution of removing the leaf node from the array after printing, but your solution is better its not updating the index++ instead index+1, nice !!!
@CodingSimplified
@CodingSimplified 4 года назад
Thanks for nice feedback. Keep Watching.
Далее
Binary Tree Paths
7:53
Просмотров 42 тыс.
ОБЗОР НА ШТАНЫ от БЕЗДNA
00:59
Просмотров 380 тыс.
Diameter of a binary tree | Leetcode #543
13:31
Просмотров 60 тыс.
A Very Exponential Equation
8:27
Просмотров 2,8 тыс.