diff --git a/blogs/Algorithm/剑指 Offer/二叉树相关.md b/blogs/Algorithm/剑指 Offer/二叉树相关.md index 4172fdb..5dc4cf2 100644 --- a/blogs/Algorithm/剑指 Offer/二叉树相关.md +++ b/blogs/Algorithm/剑指 Offer/二叉树相关.md @@ -16,7 +16,7 @@ 10. [37. 序列化二叉树](https://leetcode-cn.com/problems/xu-lie-hua-er-cha-shu-lcof/) 11. [28. 对称的二叉树](https://leetcode-cn.com/problems/dui-cheng-de-er-cha-shu-lcof/) 12. [33. 二叉搜索树的后序遍历序列](https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof/) -13. [Offer 36. 二叉搜索树与双向链表](https://leetcode-cn.com/problems/er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/) +13. [36. 二叉搜索树与双向链表](https://leetcode-cn.com/problems/er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/) #### [07. 重建二叉树](https://leetcode-cn.com/problems/zhong-jian-er-cha-shu-lcof/) @@ -552,3 +552,47 @@ class Solution { } ``` +#### [Offer 54. 二叉搜索树的第k大节点](https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof/) + +```java +class Solution { + List list = new ArrayList<>(); + + public int kthLargest(TreeNode root, int k) { + helper(root); + return list.get(list.size() - k); + } + + private void helper(TreeNode root) { + if (root == null) { + return; + } + helper(root.left); + list.add(root.val); + helper(root.right); + } +} +``` + +```java +class Solution { + int result = 0, count = 1; + + public int kthLargest(TreeNode root, int k) { + helper(root, k); + return result; + } + + private void helper(TreeNode root, int k) { + if (root == null) { + return; + } + helper(root.right, k); + if (count++ == k) { + result = root.val; + return; + } + helper(root.left, k); + } +} +``` \ No newline at end of file diff --git a/blogs/Android/口水话/View 体系相关口水话.md b/blogs/Android/口水话/View 体系相关口水话.md new file mode 100644 index 0000000..6c90ebe --- /dev/null +++ b/blogs/Android/口水话/View 体系相关口水话.md @@ -0,0 +1,16 @@ +--- +View 体系相关口水话 +--- + +#### 目录 + +1. View 绘制流程 +2. View 事件分发 +3. View 刷新机制 + +#### View 绘制流程 + +#### View 事件分发 + +#### View 刷新机制 +