8 , K=2
The sum of two smallest elements
You don't need to read input or print anything. Your task is to complete the function sum() which takes the root node and an integer K as input parameters and returns the sum of all elements smaller than and equal to kth smallest element.
Expected Time Complexity: O(K)
Expected Auxiliary Space: O(1)
1<=Number of nodes in BST<=100