Vertical Order Traversal of Binary Tree | Vertical Traversal of a Binary Tree | DSA-One Course #72

Hey guys, In this video, We're going to solve an important problem known as
'Print the Vertical Traversal order of a Binary Tree'
Practice the problem here: practice.geeksforgeeks.org/pr...
💸 Use coupon code ANUJBHAIYA on GeeksforGeeks to avail discounts on courses!
🥳 Join our Telegram Community:
Telegram channel: telegram.me/realanujbhaiya
Telegram group: telegram.me/dsa_one
🚀 Follow me on:
Instagram: / anuj.kumar.sharma
Linkedin: / sharma-kumar-anuj
Twitter: / realanujbhaiya
📚 Complete DSA Playlist: • DSA-One Course - The C...
Complete Android Development Playlist: • Android Development Tu...
Hashtags:
#anujbhaiya #dsaone
Tags:
vertical order traversal of binary tree
vertical traversal of binary tree
vertical order traversal
vertical order traversal of a binary tree
binary tree vertical order traversal
vertical traversal
top view of binary tree
binary tree
vertical order traversal of binary tree java
boundary traversal of binary tree
diagonal traversal of binary tree
dsa
level order traversal
tree traversal
level order traversal binary tree
tree dsa
314. binary tree vertical order traversal
987. vertical order traversal of a binary tree
anuj bhaiya java
binary tree traversal
bottom view of binary tree
dsa one
in order traversal
left view of binary tree
merge sort
tree
tree traversal in data structure
all nodes distance k in binary tree
apna college
bfs algoritması
binary trees
crop yield prediction based on indian agriculture using machine learning
diagonal traversal
dsa tree
flattening a linked list
invert binary tree
java anuj bhaiya
java by anuj bhaiya
java multithreading tutorial
love babbar dsa sheet
vertical order
vertical paths
zigzag traversal

Пікірлер: 45

  • @mritunjay4ever
    @mritunjay4ever2 жыл бұрын

    *The leetcode and GFG version of this problem is different.*

  • @rushidesai2836

    @rushidesai2836

    29 күн бұрын

    Yes. Leetcode version is more difficult to visualize than this. But it's doable.

  • @dipakraut6058
    @dipakraut60582 жыл бұрын

    This question is almost simlar to the Top View of Binary Tree, only difference is there we are storing first Node we get from the tree in mapValue, and here we are storing ArrayList in MapValu. and As always Great Explaination Bhaiya👌

  • @deepakvaishnav9780
    @deepakvaishnav97802 жыл бұрын

    Present sir.... Abhi tk sab samajh me aa rha h 👍 thank you

  • @lakshaybansal9597
    @lakshaybansal95972 жыл бұрын

    Only first person on yt that take me a great explanation on an vertical level traversals

  • @priyanshudwivedi3454

    @priyanshudwivedi3454

    Ай бұрын

    It means that you haven't explored KZread completely yet

  • @divyareddy7622
    @divyareddy76222 жыл бұрын

    Thank you you're single handedly saving us all 🥺🥺

  • @rosonerri-faithful
    @rosonerri-faithful2 жыл бұрын

    Best explanation on Vertical Traversal order of a Binary Tree

  • @divyanshdimri8567
    @divyanshdimri8567 Жыл бұрын

    great work bhiya , concepts clear hogye 👍🥂

  • @nandiniverma5273
    @nandiniverma5273 Жыл бұрын

    Thankyou soo much for best explanation on this traversal in java

  • @ridhi4469
    @ridhi44692 жыл бұрын

    Thank you anuj bhaiya for this good explanation.

  • @thor1626
    @thor16264 ай бұрын

    Great way to teach tbh, that dry run was super helpful.

  • @mayurkapadnis4265
    @mayurkapadnis42652 жыл бұрын

    Thank you bhaiya, totally understood

  • @abhishekkuntare4640
    @abhishekkuntare46402 жыл бұрын

    love you anuj bhaiya,you are doing very great job for us thank you so much❤️❤️👑😊😊😊🚀👍

  • @RiteshKumar-ic8bk
    @RiteshKumar-ic8bk2 жыл бұрын

    Anuj bhaiya tq for providing quality content ......bhaiya DP ka v dhyan rakheyega

  • @aayushnigam22
    @aayushnigam22 Жыл бұрын

    Thank you bhaiya, your DSA one is the most comprised and best resource for preparing for placements 😍🤗

  • @codehustler8582
    @codehustler85822 жыл бұрын

    Anuj Bhaiya is really Jeetu bhaiya

  • @16avikasgupta70
    @16avikasgupta702 жыл бұрын

    Good work bhai

  • @adityamodanwal1556
    @adityamodanwal15567 ай бұрын

    Great Bhaiya

  • @saritaprasad4295
    @saritaprasad4295 Жыл бұрын

    great explanation

  • @yashyadav7927
    @yashyadav7927 Жыл бұрын

    bhaiya this question is similar to bottom view of binary tree we just need to do small change i.e map mp;

  • @aashishjadhav4415

    @aashishjadhav4415

    Жыл бұрын

    actually this concept is used to solve bottom view

  • @mrrandom7255
    @mrrandom72552 жыл бұрын

    Bhaiya please can you upload full course asap please !!!

  • @vipsongs5060
    @vipsongs50602 жыл бұрын

    Bhaiya dp , graph , and advanced data structures aayega na

  • @saiteja2168
    @saiteja21682 жыл бұрын

    Bhayya i do want this code in cpp

  • @siddharthkanojiya1068
    @siddharthkanojiya10682 жыл бұрын

    Bhaiya ek optimal binary search tree pe video banao. Samjh nhi aa rha baki videos me

  • @gtbaba123
    @gtbaba123 Жыл бұрын

    there is catch if same element in level and horizontal distances the insertion should be in sorted order which makes question more annoying.

  • @moinmemon5764
    @moinmemon5764 Жыл бұрын

    I really like your videos but this problem can be solved through normal tree traversal (recusion) eg inorder traversal. if we take care of both vertical distance (left-> -1 , right-> +1) as well as horizontal distance (level) I agree it might be easy with level order traversal, but recursion totally doable & clean PS - learnt recusion (in general) from you only :)

  • @divyanshdimri8567

    @divyanshdimri8567

    Жыл бұрын

    no i dont think so coz inorder goes on the extreme left let say we have 3 nodes on the left from root so last node on the left will be -3 and after the last node it will go to the right so with ur concept u will do +1 which will be -2 but it shud be -1 . try it urself :)

  • @Rishabh-ev1fh
    @Rishabh-ev1fh Жыл бұрын

    plz anyone share code link

  • @HimanshuGupta-ni3pk
    @HimanshuGupta-ni3pk Жыл бұрын

    why we write "new" keyword inside q.add(new pair()) ?

  • @aashishjadhav4415

    @aashishjadhav4415

    Жыл бұрын

    bcz every time we are making new object of Pair class

  • @yashbhavsar7148
    @yashbhavsar71482 жыл бұрын

    Thank sir your videos are helping me alot ........ But i have one problem can you explain it once how to take matrix input in java for placement coding round because they are given in comma separated for just like 1,2,3 2,3,4..

  • @kiku_to_herself

    @kiku_to_herself

    2 жыл бұрын

    I think u should consider buffered reader for this Read about it , and there are ways to take such input. I faced the same problem in infytq , and I used buffered reader there And mostly in java , when u will see , input is taken using buffered reader So consider , studying about it

  • @deepakvaishnav9780
    @deepakvaishnav97802 жыл бұрын

    Bhaiya me tier 3 college se hu... Mera placement tier 1 company me ho jaye to mera interview le lena 😁😛

  • @SaurabhSingh-ji7id
    @SaurabhSingh-ji7id6 ай бұрын

    In Js getting out of heap class Solution { //Function to find the vertical order traversal of Binary Tree. verticalOrder(root) { let ans = {}; function helper(root, vh) { if (!root) { return; } if (ans[vh] != undefined) { ans[vh] = [...ans[vh], root.data]; } else { ans[vh] = [root.data] } helper(root.left, vh-1) helper(root.right, vh+1) } helper(root, 0); return Object.keys(ans).sort((a, b)=>a-b).map((ele)=> [...ans[ele]]).flat() } }

  • @arpanmaheshwari2290
    @arpanmaheshwari22902 жыл бұрын

    First

  • @somnathmore1082
    @somnathmore10822 жыл бұрын

    111

  • @notaniitian3988
    @notaniitian39882 жыл бұрын

    Bhaiya Graph Shuru kra do.

  • @stepup8108
    @stepup8108 Жыл бұрын

    treemap banane ke baad to wo nlogn TC hogaya

  • @ritesh.kumar91
    @ritesh.kumar912 жыл бұрын

    Your Tree on Board is itself wrong.. please check i.e. 60 should be less than root node

  • @devanshprakash8354

    @devanshprakash8354

    Жыл бұрын

    Abe bewakoof yeh binary tree h not bst

  • @ashishkumarshawhitchem2017
    @ashishkumarshawhitchem2017 Жыл бұрын

    this code is not working in leetcode

  • @ashishkumarshawhitchem2017

    @ashishkumarshawhitchem2017

    Жыл бұрын

    but working in gfg

  • @undextered

    @undextered

    Жыл бұрын

    @@ashishkumarshawhitchem2017 because leetcode wants elements in the same column sorted by their values

Келесі