Change of Key in BST
Easy Accuracy: 37.7% Submissions: 3584 Points: 2

Given a Binary Search Tree of size N, your task is to complete the function changeKey() that change old key value present in the tree and changes it to new key value.
Example:

Input: Root of below tree
50
/     \
30      70
/  \    /  \
20   40  60   80
Old key value:  40
New key value:  10

Output: BST should be modified to following
50
/     \
30      70
/       /  \
20      60   80
/
10

Input:
The function takes three arguments, reference pointer to the root node of the BST, old key value of the node and a new key value.
There will be T test cases and for each test case the function will be called separately.

Output:
For each test case output the Inorder traversal of the Tree.

Constraints:
1<=T<=100
1<=N<=500

Example:
Input:

1
7
20 8 22 4 12 10 14
8 1
Output:
1 4 10 12 14 20 22

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.