Shubham Gautam
Oct 18, 2021

--

Hi Shubhojit,

Thanks for asking this excellent question. This is just a convention because traversals from right to left are the mirror view of the left to right traversal. As you mentioned, another idea would be: our natural psychology is to traverse from left to right order.

But sometimes: we also use reverse traversal in tree problem-solving. For example, we use reverse in-order traversal in the case of BST. So understanding the recursive flow of reverse traversal is a good idea.

For example, You can try solving this problem using reverse in-order traversal - https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/

Enjoy learning, and let us know if you need any further insight.

--

--

Shubham Gautam
Shubham Gautam

Written by Shubham Gautam

Founder enjoyalgorithms.com | IIT | Super 30 | Educator | A learner who enjoys computer science, programming, algorithms, and problem-solving.

Responses (1)