Is it more efficient to do this versus using a List? using a regular level order traversal - Top View : Use a queue in the HashTable, and foreach keyvaluepair ordered by key, u just have to peek the queue. Bottom View : Use a stack in the HashTable and foreach keyvaluepair ordered by key, u just have to peek the stack.
If 'G' node didn't have its left and right nodes and 'D' node didn't have its left and right nodes then our ideal answer should be d, b, e, f, c, g. But according to our algorithm d, b, f, c, g as our 'e' and 'f' nodes hd value is equal to 0. Can some one explain?
Hi sir, I think doing inorder traversal while printing the nodes which has left and right children as null will also work. if it works then it will be better way right?
it wont work all the times wen ur tree has only 3 nodes root,left and right then ur bottom view contains all 3 nodes but ur logic prints only left and right child hence it fails
The solution seems incorrect for below case - a / \ b c / \ / \ d e f g hd - a = 0 b = -1 c = 1 d = -2 e = 0 f =0 g = 2 By your algo, dbfcg should print, which in correct.
The honesty you pour while explaining is priceless. Thanks : )
That smile when he said these are over each other..9:32
bhai 🤣🤣🤣🤣🤣
Sir....u r officially awesome..... means the ease with which u explain the stuff is superb !! Thanks again
Wonderful explanation, can understand very clearly, thanks a lot!!
Great Job , Thanks for uploading.
Nice explanation .Sir please upload a video on "cloning a binary tree" .
thank you
yes sure parmanand..!
Awesome explanation sir , keep uploading
Is it more efficient to do this versus using a List? using a regular level order traversal -
Top View : Use a queue in the HashTable, and foreach keyvaluepair ordered by key, u just have to peek the queue.
Bottom View : Use a stack in the HashTable and foreach keyvaluepair ordered by key, u just have to peek the stack.
same thoughts
very good explanation .. impressed
Great work man, keep going.
sir can you explain algorithm for solving rat in a maze problem
It would be very helpful if you show us the working code in any programming language at the end.
check out geeks for geeeks for code
Thanks. Very helpful
Thanks for the explanation!
sir you are fantastic
If 'G' node didn't have its left and right nodes and 'D' node didn't have its left and right nodes then our ideal answer should be d, b, e, f, c, g.
But according to our algorithm d, b, f, c, g as our 'e' and 'f' nodes hd value is equal to 0.
Can some one explain?
his implementation has a small bug that it is not vertical order traversal, its horizontal level traversal.
sir u r immensely requested to put the videos of hashing using code in c. It shud contain some examples.
Nicee!
This implementation has a small bug that it is not vertical order traversal, its horizontal level traversal.
Thanks a lot sir
Thank u very much sirrr!!!!
Thanks its very helpful
Hi sir, I think doing inorder traversal while printing the nodes which has left and right children as null will also work. if it works then it will be better way right?
good idea
it wont work all the times wen ur tree has only 3 nodes root,left and right then ur bottom view contains all 3 nodes but ur logic prints only left and right child hence it fails
sir ,please upload the code in the discription .thank you
Why do ppl ask for code. Will the mug up?? If yes how useful it is.
Thanks bruh
u r gr8
Sir provide the git link for the code if you'have.
thnx man
Please upload the code.
Cool. ^^
Why d should be part of bottom view ?
but sir if we also have to print nodes at same horizontal distance ...then do we need to keep track of vertical distance too??
If yes how?????
we only need horizontal distance......Thanks Ankit.......i will discuss more on this problem if you want.
Yes sir
The solution seems incorrect for below case -
a
/ \
b c
/ \ / \
d e f g
hd -
a = 0
b = -1
c = 1
d = -2
e = 0
f =0
g = 2
By your algo, dbfcg should print, which in correct.
bhut ghatiya explanation