Given a binary search tree, write a function to find the kth smallest element in the tree. Input Format
NOTE: You may assume 1 <= k <= Total number of nodes in BST
The first argument is the root node of the binary tree.Output Format
The second argument B is an integer equal to the value of k.
Return the value of the kth smallest node.Example Input
As 2 is the second smallest element in the tree.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.