BST - 671. Second Minimum Node In a Binary Tree

Binary tree's node's children:
either equal to its value,
or smaller than it.

Therefore, for root node:
it is the smallest of course;

  • if both of its children are bigger than it, then take the MIN(its children).

  • if at least one child equals to it:
    then look down.

Java divide and conquer solution

230. Kth Smallest Element in a BST

Hint:

  1. Try to utilize the property of a BST.
  2. What if you could modify the BST node's structure?
  3. The optimal runtime complexity is O(height of BST).

二叉树遍历

[Leetcode] Binary Tree Traversal 二叉树遍历

Binary Tree Inorder Traversal

[LeetCode] Kth Smallest Element in a BST 二叉搜索树中的第K小的元素

BST的性质:
parent

这又是一道关于二叉搜索树 Binary Search Tree 的题, LeetCode中关于BST的题有Validate Binary Search Tree 验证二叉搜索树, Recover Binary Search Tree 复原二叉搜索树, Binary Search Tree Iterator 二叉搜索树迭代器, Unique Binary Search Trees 独一无二的二叉搜索树, Unique Binary Search Trees II 独一无二的二叉搜索树之二,Convert Sorted Array to Binary Search Tree 将有序数组转为二叉搜索树 和 Convert Sorted List to Binary Search Tree 将有序链表转为二叉搜索树。

你可能感兴趣的:(BST - 671. Second Minimum Node In a Binary Tree)