class Solution {
private int res = 0, n = 0;
public int kthLargest(TreeNode root, int k) {
//思路:递归、右、中、左,数递归的次数为k
if(root ==null)
return 0;
searchTree(root,k);
return res;
}
public void searchTree(TreeNode root,int k){
if(root == null)
return ;
searchTree(root.right,k);
n++;
if(n == k)
res = root.val;
searchTree(root.left,k);
}
}