Nice video , just a minor correction : print root node first and then pass root's left to the print_left function . Otherwise it will fail for a tree having only right nodes.
this is a very great explanation, I appreciate all of your videos. a small thing 1. root needs to be dealt with independently before process left and right subtree
in the left tree recursion ,if e finishes the recursion stack then after some time it go back to C and from C it look ,it's have right subtree or not ,it have so it add C again
Hi Vivekanand, very clear explanation..Thanks. One request, could you please also mention some use cases (applications) of each of the traversals? This would motivate the viewers.
The way he says Hello friends itself takes my anxiety away.. Thank you for your efforts.
Nice video , just a minor correction : print root node first and then pass root's left to the print_left function .
Otherwise it will fail for a tree having only right nodes.
Just can't tell , how good you are ! Your videos have been really helpful for me in preparing for data structures interviews..! :)
Sir just want to say thank you for this wonderful video. You are OP sir...........
You are genius!! Thank you so much for a simple explanation
Can I say that we need to find
1) left view of binary tree
2) right view of binary tree
3) find leaf nood of binary tree ?
no
@@RahulKashyap-yv5ox why?
very well explained sir, thank you for detailed explanation
can you make a series on solving the competitive programming question
Plz sir
Superb explanation!
this is a very great explanation, I appreciate all of your videos.
a small thing
1. root needs to be dealt with independently before process left and right subtree
Your explanation is nice... but if the tree is skewed it will print the boundary elements multiple times.
true
in the left tree recursion ,if e finishes the recursion stack then after some time it go back to C and from C it look ,it's have right subtree or not ,it have so it add C again
Hi Vivekanand, very clear explanation..Thanks. One request, could you please also mention some use cases (applications) of each of the traversals? This would motivate the viewers.
really really good man!
Sir there are many videos which are not added in playlist, Can you please add it
Nice video,also please mention Time complexity for algorithm
Requires to change the position of print in print_right function.
the error lies using 2 "if" instead of 1 if and 1 else if
In Right Boundary Condition,there is a correction. First we need to traverse to right child and then print the data.
Thanks, my python implementation:
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def __init__(self):
self.root = []
self.lb = []
self.rb = []
self.leaves = []
def boundaryOfBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
if not root:
return root
self.root.append(root.val)
self.left_bdr(root.left)
self.leaf(root.left)
self.leaf(root.right)
self.right_bdr(root.right)
return self.root + self.lb + self.leaves + self.rb[::-1]
def left_bdr(self, root):
if root:
if root.left:
self.lb.append(root.val)
self.left_bdr(root.left)
elif root.right:
self.lb.append(root.val)
self.left_bdr(root.right)
def right_bdr(self, root):
if root:
if root.right:
self.rb.append(root.val)
self.right_bdr(root.right)
elif root.left:
self.rb.append(root.val)
self.right_bdr(root.left)
def leaf(self, root):
if root:
self.leaf(root.left)
self.leaf(root.right)
if not root.left and not root.right:
self.leaves.append(root.val)
can u please provide quick sorting and merge sorting .
You are really awesome dude
Sir can you plz explain the M-way search tree ........
you need an extra condition to check if the tree is skewed otherwise the code will fail
wrong, Not work for skew trees
very clear, thanks a lot!
Sir can u explain rope data structure please
Plz solve postorder traversal from
Given in order,preorder
Sir your code is wrong it does not work for input (15,10,8,12,13,20,17,25)
awsome sir
sorry sir ,
not working for right skew tree
return "very well explained" ;
wrong code
its not printing in correct order, to get correct order,in right view all the printing statements should be just below of recursive calling function.
Thanks ....
you could have easily gone anticlockwise...this doesn't make much sense, sorry