I have a Binary Search Tree and each of its node has two values.
int value;
String name;
So its node is like this.
class Node {
int value;
String name;
Node left, right;
}
I have inserted values in BST according to the ascending order of "name" variable of node. So inorder traversal of tree will return the nodes in ascending order of "name".
Now I want to display the tree nodes according to ascending order of "value" variable. Without changing the original tree. What algorithm/approach will be most efficient for this?