leetcode-剑指54-OK

address

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */


int kthLargest(struct TreeNode* root, int k){
    int count=0;
    void countALL(struct TreeNode* tree){
        if(tree ==NULL)
            return;
        countALL(tree->right);
        k--;
        if(k==0){
            count = tree->val;
            return;
        }
        countALL(tree->left);
    }
    countALL(root);
    return count;
}
原文地址:https://www.cnblogs.com/gallien/p/14323180.html