I have skipped Morris Traversal for the past 7 years because I never understood it. Turns out, I only had to watch this 10 minute clip. Thanks a ton man.
Wow the intro is so good!! now I understand why thread(link) is needed! bc we have to come back root, without stack or recursion! wow Thanks my teacher!!!
It’s a good explanation for those looking in to the problem already and stuck with solving it. For those looking in to the problem first time, it would help if the pace of explanation is bit slower.
Hi Tushar. I want to thank you for this video. I looked at almost all sources that explain morris traversal but yours actually made everything clear in my mind. Keep making more videos like this. Thanks again.
There's a LOT of bad articles poorly explaining this, and I gave up after checking a few. This cleared it up pretty quickly. I do wish in his first pass he hadnt abstracted findPredecessor() into some invisible function.
Excellent explanation of Morris Algorithm !! keep up the good wrk Tushar !! I keenly follow your videos and they are immensely helpful in understanding concepts of Compute rScience.
I think the worst case time complexity will be O(n^2). Correct me if I am wrong. Coz we will have to find inorder predecessor for all nodes. And in case of skwed tree, it will take O(n^2) time.
there is a problem at 6:45 , after visiting -1 , we got to 2 , then we begin finding predecessor of 2 , Alas , finding predecessor of 2 means going right most in left sub-tree of 2 , here left subtree is -1 , then lets find predecessor ,-1 -> right = 2 , then 2-> right = 5 , 5-> right = 6 , 6-> right = 8 , 8 ->right = 10 , we are moving in totally different direction ....now . Actually this must stop when predecessor is found , but for predecessor , we keep moving right ? Edit: Now I saw the final code , while finding predecessor , you solved the problem by doing , predecessor-> right = current , then break .
Thanks for your hard work for making such nice videos! But it would be great if the video explains algorithm derived from concept behind it. What I understand, concpet is the first thing then algo comes. You explan such a way where algo comes first then explain the concept based on the algo! Thank you!
Tushar, Great effort on the explanation. But, it seems your algorithm on the board was incomplete (like when the predecessor->right hits the current item itself, then it should stop). Although, you do talk about it while you showcased the code. Also, When you said current becomes current-> right @7:27 , you should actually be pointing at the last else section of your algorithm.
well explained Tushar.. Just one comment for the viewers this Morris approach can be for Pre order traversal also ..and with just 1 line change in the existing code..( let it be a exercise for the viewers)
For Morris Postorder feel free to take a look at www.thealgorists.com/Algo/Tree/MorrisPostorder . Morris Postorder algorithm and code are beautifully explained there.
predecessor.right will always be null right? Because if a predecessor of a current node has a right child, then that right child is the predecessor of the current node, no?
Good luck to everyone working hard to be at good tech companies. Thank you for the explanation.
so nice 😊
came here when I didn't get the geeksforgeeks explanation. you have explained it lucidly.
I came like that as well. Lol!
same her bro..
Me too
Me too :-)
Me too:}
Best explanation ever. Better than pepcoding, better than Striver.
Same thoughts
You never fail to impress. Your explanations are always crystal clear and easy to understand. Thanks for sharing your knowledge!!
Man I spent like 2 hours trying to understand the code, but visually seeing it step by step made it finally make sense, thanks!
OK man
Out of all Morris algorithm explanations out there, yours is so much better. Thank you!
I have skipped Morris Traversal for the past 7 years because I never understood it. Turns out, I only had to watch this 10 minute clip. Thanks a ton man.
Thank you! This was the best explanation I found. Instead of going straight into algorithm, Tushar explained the thought behind it. Great job.
Almost I gave my 2 hours to understand this algorithms on others channel but when I watched this video I got it. Great explanation.
Thank you Tushar! Your video is always a guarantee of crystal clarity. Kudos!
Thank you! This is the most thorough video explanation on Morris Traversal that I have been able to find.
Wow the intro is so good!! now I understand why thread(link) is needed! bc we have to come back root, without stack or recursion! wow Thanks my teacher!!!
It’s a good explanation for those looking in to the problem already and stuck with solving it. For those looking in to the problem first time, it would help if the pace of explanation is bit slower.
Hi Tushar. I want to thank you for this video. I looked at almost all sources that explain morris traversal but yours actually made everything clear in my mind. Keep making more videos like this. Thanks again.
his diagram is clean and clear enough to demonstrate the concept
There's a LOT of bad articles poorly explaining this, and I gave up after checking a few. This cleared it up pretty quickly. I do wish in his first pass he hadnt abstracted findPredecessor() into some invisible function.
Best person to explain complex topics. I wonder why his channel is not very famous?
The best explanation I found on youtube so far
Best explanation of Morris traversal on the internet
Thanks tushar For explaining in simple manner with algorithm and code.
I am very thankful for your clear explanation and pronunciation!
your speaking is way better than others
awesome explanation Much much better than Geeks for geeks
Excellent explanation of Morris Algorithm !! keep up the good wrk Tushar !! I keenly follow your videos and they are immensely helpful in understanding concepts of Compute rScience.
Beautifully explained, thank you. Subbed.
The best video about morris! Love your video!
Thanks, best video on this algorithm!
Nice explanation sir...
Man, you are always so helpful explaining those fancy algorithms.
Loved your explanation
Great, very intuitive and explanative
A+++++ explanation. Really appreciate it!
i really appreciate the hard work to teach us thank you
thank you for the video!! but at 7:27 current = current.right, but you were pointing to the wrong place on the white board.
Thank you very much for the clear explanation.
Clean and precise explanation !!
Very nice explanation 🙌🙌
Explanation is Awesome !
I think the worst case time complexity will be O(n^2). Correct me if I am wrong. Coz we will have to find inorder predecessor for all nodes. And in case of skwed tree, it will take O(n^2) time.
The TC will still be 2N which is O(N) as the nodes visited at max twice.
Precise and sweet explanation. thanks :)
Amazing explanation man, props to you!
Awesome man... Nice explanation
Great walkthrough, thank you!
Thank you for all your videos :)
Awesome explanation, made this complex algo smooth.
Very good explanation!!
Thanks for your explanation! I was confused about Morris Traversal, but you video make me clear now.
Very Good Explanation Thanks
You explain very well. Thank you
Talk about an elegant algorithm.
Explanation was very nice , thanks for the vid :D
there is a problem at 6:45 , after visiting -1 , we got to 2 , then we begin finding predecessor of 2 ,
Alas , finding predecessor of 2 means going right most in left sub-tree of 2 ,
here left subtree is -1 , then lets find predecessor ,-1 -> right = 2 , then 2-> right = 5 , 5-> right = 6 , 6-> right = 8 , 8 ->right = 10 , we are moving in totally different direction ....now .
Actually this must stop when predecessor is found , but for predecessor , we keep moving right ?
Edit: Now I saw the final code , while finding predecessor , you solved the problem by doing , predecessor-> right = current , then break .
Thanks for your hard work for making such nice videos!
But it would be great if the video explains algorithm derived from concept behind it.
What I understand, concpet is the first thing then algo comes. You explan such a way where algo comes first then explain the concept based on the algo! Thank you!
Why not to use threaded three in the first place?
Thank You Tushar.. Nice explanation. It really helped me.
Dude, you're awesome. Thank you for these videos.
Great explaination!
clean algorithm, beautifully explained. thank you so much!
Tushar, Great effort on the explanation. But, it seems your algorithm on the board was incomplete (like when the predecessor->right hits the current item itself, then it should stop). Although, you do talk about it while you showcased the code. Also, When you said current becomes current-> right @7:27 , you should actually be pointing at the last else section of your algorithm.
exactly, i was also confused by that pointing...
very well explained..thank you so much
Thanks so much for making my life easier!!!
Thank You
That's great explanation!
how is the time complexity O(n)... we are revisiting nodes in a loop many times...
Nice explanation!
Thank you great explanation
Nicely explained. Thanks!
Thank you for your explanation.
why time complexity is O(n)?
Awesome! Thank you Tushar!! :D
Excellent explanation!
Explanation is excellent , simple request is to talk at steady pace. a bit slower ...then it will be much easier to absorb :)
good explanation, Sometimes I feel it's really helpful for yourself to understand better by presenting your idea to others
Can we use this to traverse inorder reversely(right->root->left) ? ig yes ...reply if not
really made it easy to understand
Nice explained♥️
I've watched this like 10 times xD
Thank you so much. I kept looking at an implementation and had a hard time trying to figure out what was happening. I got it now.
This is much clearer than the explanation on the geekforgeeks channel.
Nice explanation
Amazing as always!!
very clear explanation!
could you please make similar videos for Morris traversal for priorder and post order traversal
Great video! Thanks.
I love this guy
Patience, friends. Bit by bit.
Very well explained ... !!!!
Nice Explanation
Thanks a lot!
Great explanation
well explained Tushar.. Just one comment for the viewers this Morris approach can be for Pre order traversal also ..and with just 1 line change in the existing code..( let it be a exercise for the viewers)
+Tushar Roy oh !! I had not seen the full video earlier.. yes its there..
For Morris Postorder feel free to take a look at www.thealgorists.com/Algo/Tree/MorrisPostorder . Morris Postorder algorithm and code are beautifully explained there.
thanks, sir really nice explanation....!
very clear, thank you so much
very clear thank you so much
predecessor.right will always be null right? Because if a predecessor of a current node has a right child, then that right child is the predecessor of the current node, no?
Nevermind, we need that if statement to see if we establish a link to a "current" node
Don't you spit whenever you say "t"?
nice explanation
nice explanation!
thanks for the explanation
awesome stuff mate..awesome
Time complexity?