diff --git a/15 October k-th Smallest in BST b/15 October k-th Smallest in BST new file mode 100644 index 0000000..e44f6ee --- /dev/null +++ b/15 October k-th Smallest in BST @@ -0,0 +1,12 @@ +class Solution { + public: + int kthSmallest(Node *root, int &k) { + // code here + if(root == NULL) return -1; + int tmp = kthSmallest(root -> left, k); + if(tmp != -1) return tmp; + k--; + if(k == 0) return root -> data; + return kthSmallest(root -> right, k); + } +};