codeintuition-logo

Understanding the reversed sorted traversal pattern


Some problems require us to traverse the nodes of a binary search tree in the reverse sorted order of their values. The inorder traversal traverses the nodes in the sorted order of the values of the nodes. However, the reverse inorder traversal that follows the right-node-left sequence traverses the nodes in the tree in the sorted order(descending) of their values. This is because a binary search tree follows the binary search property where all the nodes in the left subtree of a node have values smaller than it, and all the nodes in the right subtree have values greater than it. And Ssoso, the reverse inorder traversal can be used to traverse the nodes in a binary search tree in the reverse sorted order(descending) of its values.

The reverse sorted traversal pattern is a classification of problems that can be solved using the reverse sorted traversal technique.
Loading Image

The reverse inorder traversal traverses the binary search tree in the reverse sorted order (descending) of node values.

Liking the course? Check our discounted plans to continue learning.