Binary Tree
前排提示
- 中英文混写
- 基础复习
- 目标读者:我自己(复习用)
罗列一下各种树, 这个链接总结的特别好,我自己再总结一下加深印象
Binary Tree
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.

Binary Search Tree
Binary Search Tree is a node-based binary tree data structure which has the following properties:
- The left subtree of a node contains only nodes with keys lesser than the node’s key.
- The right subtree of a node contains only nodes with keys greater than the node’s key.
- The left and right subtree each must also be a binary search tree.
- There must be no duplicate nodes.

Complete Binary Tree
A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

Special case: full binary tree, which is completely filled, even the last level
Balanced Binary Tree
A Balanced Binary Tree is a binary tree that full-fills all following requirements.
- The left and right subtrees’ heights differ by at most one
- The left subtree is balanced
- The right subtree is balanced
AVL
Typical self-balancing BST
Red Black Tree
Another typical self-balancing BST.
Rules for red black tree:
- Every node has a color either red or black.
- Root of tree is always black.
- There are no two adjacent red nodes (A red node cannot have a red parent or red child).

划重点 - Why red black tree?
- red black tree vs AVL
- How to implement?
必看1
必看2
B+/B-
还没学到。回头再更。我们专业database居然是选修课,专业选的好,自学学到老
FAQ
- Tree Traversel (Inorder, preorder, postorder)
- Delete/Insert/Rotate nodes
- lists of leetcode problems
Leetcode (待更)
110 Balanced binary tree
- return true if it’s balanced, otherwise return false
- recursion (bottom up/ top down)
- recall what’s balanced binary tree
- The left and right subtrees’ heights differ by at most one
- The left subtree is balanced
- The right subtree is balanced
References
JAVA知识全栈体系
Geeks for Geeks
Wikipedia
leetcode
Tech Interview Prep List
这篇博客概述了二叉树的各种类型,包括Binary Tree、Binary Search Tree、Complete Binary Tree、Balanced Binary Tree,特别讨论了AVL树和Red Black Tree。博主强调了这些树的数据结构特性,并提及了在LeetCode上的相关问题,如检查是否为平衡二叉树。此外,还提到了树的遍历方法和节点操作,以及资料来源。
2892

被折叠的 条评论
为什么被折叠?



