【leetcode】230. 二叉搜索树中第K小的元素
int recursion(struct TreeNode* root, int* k,int* ret){ if(!root || *k==0) return *ret; recursion(root->left,k,ret); if(--(*k)==0){ *ret = root->val; } recursion(root->right,k,ret); return *ret; } int kthSmallest(struct TreeNode* root, int k){ int ret=0; return recursion(root,&k,&ret); }