Boundary traversal of binary tree (Border Elements)

  Рет қаралды 26,968

Vivekanand Khyade - Algorithm Every Day

Vivekanand Khyade - Algorithm Every Day

Күн бұрын

Пікірлер: 42
@CodeSuccessChronicle
@CodeSuccessChronicle 3 жыл бұрын
The way he says Hello friends itself takes my anxiety away.. Thank you for your efforts.
@surajjha5542
@surajjha5542 6 жыл бұрын
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.
@aakashparmar560
@aakashparmar560 3 жыл бұрын
Sir just want to say thank you for this wonderful video. You are OP sir...........
@meghasharma3092
@meghasharma3092 4 жыл бұрын
Just can't tell , how good you are ! Your videos have been really helpful for me in preparing for data structures interviews..! :)
@minirasamedova648
@minirasamedova648 3 жыл бұрын
You are genius!! Thank you so much for a simple explanation
@JJ-Bond
@JJ-Bond 5 жыл бұрын
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
@kasyapdharanikota8570
@kasyapdharanikota8570 3 жыл бұрын
very well explained sir, thank you for detailed explanation
@AlancRodriguez
@AlancRodriguez 3 жыл бұрын
Superb explanation!
@sandeepsinghnegi3644
@sandeepsinghnegi3644 6 жыл бұрын
can you make a series on solving the competitive programming question
@anindyasundarhazra2523
@anindyasundarhazra2523 3 жыл бұрын
Plz sir
@chrisy.703
@chrisy.703 2 жыл бұрын
really really good man!
@arpitgupta1143
@arpitgupta1143 5 жыл бұрын
Your explanation is nice... but if the tree is skewed it will print the boundary elements multiple times.
@sandhyagupta7359
@sandhyagupta7359 4 жыл бұрын
true
@Algo_Guru
@Algo_Guru 4 жыл бұрын
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.
@ibrahimshaikh3642
@ibrahimshaikh3642 5 жыл бұрын
Nice video,also please mention Time complexity for algorithm
@karthikrashinkar204
@karthikrashinkar204 3 жыл бұрын
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 ?
@RahulKashyap-yv5ox
@RahulKashyap-yv5ox 3 жыл бұрын
no
@_ADITIKAJALE
@_ADITIKAJALE 3 жыл бұрын
@@RahulKashyap-yv5ox why?
@edwardteach2
@edwardteach2 3 жыл бұрын
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)
@user-mo1vm2nt7l
@user-mo1vm2nt7l 5 жыл бұрын
You are really awesome dude
@amitranjan6998
@amitranjan6998 2 жыл бұрын
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
@roshanraut3093
@roshanraut3093 4 жыл бұрын
Requires to change the position of print in print_right function.
@harshanand4018
@harshanand4018 3 жыл бұрын
In Right Boundary Condition,there is a correction. First we need to traverse to right child and then print the data.
@feisuxiaozhu
@feisuxiaozhu 5 жыл бұрын
very clear, thanks a lot!
@jeeveshkataria6439
@jeeveshkataria6439 4 жыл бұрын
wrong, Not work for skew trees
@aayush5474
@aayush5474 4 жыл бұрын
you need an extra condition to check if the tree is skewed otherwise the code will fail
@mahipalsingh-yo4jt
@mahipalsingh-yo4jt 4 жыл бұрын
return "very well explained" ;
@Sarojkumar-yh9uy
@Sarojkumar-yh9uy 6 жыл бұрын
awsome sir
@Sarojkumar-yh9uy
@Sarojkumar-yh9uy 6 жыл бұрын
sorry sir , not working for right skew tree
@PradeepSingh-ov3bt
@PradeepSingh-ov3bt 6 жыл бұрын
the error lies using 2 "if" instead of 1 if and 1 else if
@DeepakGupta-zz1vf
@DeepakGupta-zz1vf 3 жыл бұрын
Sir there are many videos which are not added in playlist, Can you please add it
@vikasbajpai3013
@vikasbajpai3013 6 жыл бұрын
wrong code
@user-mo1vm2nt7l
@user-mo1vm2nt7l 5 жыл бұрын
Sir your code is wrong it does not work for input (15,10,8,12,13,20,17,25)
@ganeshiitr-cse6328
@ganeshiitr-cse6328 5 жыл бұрын
Thanks ....
@vash721
@vash721 6 жыл бұрын
Sir can you plz explain the M-way search tree ........
@285ravi
@285ravi 6 жыл бұрын
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.
@aashutoshvatsa5152
@aashutoshvatsa5152 5 жыл бұрын
can u please provide quick sorting and merge sorting .
@railgang5026
@railgang5026 5 жыл бұрын
Plz solve postorder traversal from Given in order,preorder
@deepakgoyal589
@deepakgoyal589 6 жыл бұрын
Sir can u explain rope data structure please
@user-zj9pq5xc7x
@user-zj9pq5xc7x 4 ай бұрын
you could have easily gone anticlockwise...this doesn't make much sense, sorry
Vertical Order Traversal of a Binary tree (Algorithm)
18:35
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 71 М.
INORDER SUCCESSOR in binary search tree[CODE Explained]
21:17
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 45 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 60 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 11 МЛН
Молодой боец приземлил легенду!
01:02
МИНУС БАЛЛ
Рет қаралды 2,1 МЛН
L20. Boundary Traversal in Binary Tree | C++ | Java
9:47
take U forward
Рет қаралды 276 М.
Spiral (zig-zag) level order traversal of a binary tree
14:12
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 34 М.
Binary tree: Level Order Traversal
11:23
mycodeschool
Рет қаралды 612 М.
INORDER PREDECESSOR in Binary Search Tree
22:51
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 42 М.
L21. Vertical Order Traversal of Binary Tree | C++ | Java
18:53
take U forward
Рет қаралды 336 М.
Diameter of a Binary Tree (Code/ Algorithm)
17:15
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 94 М.
Bottom view of a Binary Tree Algorithm
12:28
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 36 М.
How Deep Neural Networks Work - Full Course for Beginners
3:50:57
freeCodeCamp.org
Рет қаралды 4,4 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 60 МЛН