平衡树——2-3树(Binary Search Tree
来源:互联网 发布:skype mac 编辑:程序博客网 时间:2024/05/17 06:05
平衡树——2-3树(Binary Search Tree - 2-3 Tree)
简介(Introduction)
2-3 trees and 2-3-4 trees are binary search trees that allow one node have more than one items stored.
For BSTs, a node that holds a single item has at most two children. It is called 2-node.
For 2-3 tree, a node that can hold two items has at most three children. It is called 3-node.
For 2-3-4 tree, a node that can hold three items has at most four children. It is called 4-node.
构造2-3树(Building 2-3 tree)
We can build a 2-3 tree by inserting item one by one. To insert a key k, we pretend to search for it. This will take us to a leaf node in the tree, where k should now be inserted. If the node we find is a 2-node, k can be inserted without further ado. Otherwise we get a 3-node. The two inhabitants together with k form a node with three elements. We call them k1, k2 and k3 in sorted order. We now split the node, k1 and k3 forms their individual 2-node and k2 is promoted to the parent node. If the promotion cause the parent node overflow, split parent node in the same way.
示例(Example)
Build a 2-3 tree from 9, 5, 8, 3, 2, 4, 7.
时间复杂度(Time Complexity)
Searching, insertion and deletion are O(logn).
写在后面的话(PS)
Welcome questions always and forever.
- 平衡树——2-3树(Binary Search Tree
- 平衡树 - AVL || Balanced Binary Search Tree
- 树——recover-binary-search-tree
- 平衡树 balanced binary tree (AVL tree)
- 【二叉树】有序数组建平衡二叉树【108. Convert Sorted Array to Binary Search Tree】
- LeetCode--Convert Sorted Array to Binary Search Tree(平衡二叉搜索树)
- 数据结构与算法9: 二叉搜索树全局平衡算法(Binary search tree global reblancing)
- Leetcode 108 Convert Sorted Array to Binary Search Tree 有序数组构造平衡二叉查找树
- 有序数组转换为平衡二叉搜索树(Convert Sorted Array to Binary Search Tree)
- LeetCode Convert Sorted List to Binary Search Tree(有序单链表转为平衡二叉树)
- 108. Convert Sorted Array to Binary Search Tree 有序数组转换为平衡二叉搜索树
- 108. Convert Sorted Array to Binary Search Tree | 有序数组生成平衡二叉搜索树
- [LeetCode]108. Convert Sorted Array to Binary Search Tree(升序数组转化为平衡二叉树)
- (将有序数组转成平衡二叉树)LeetCode#108. Convert Sorted Array to Binary Search Tree
- leetcode 108. Convert Sorted Array to Binary Search Tree 构建平衡二叉搜索树 + DFS
- Leetcode#108. Convert Sorted Array to Binary Search Tree (平衡二叉查找树)
- LeetCoode—**Convert Sorted List to Binary Search Tree 将单链表表示为平衡二叉
- 二叉查找树——Validate Binary Search Tree
- 如何勾搭程序员?这有 11 个正确的姿势
- USACO-Section1.3 barn1[贪心]
- Binary String Matching
- containsKey
- NLTK学习笔记(三):NLTK的一些工具
- 平衡树——2-3树(Binary Search Tree
- 通过opengl es 2.0来实现yuv(NV21)的显示
- Oracle 库缓存 和shared Cursor (下)
- websocket学习资料总集
- 传输控制协议TCP
- 爽子-挂念
- html注入
- TensorFlow文件操作
- leetCode刷题归纳-Dynamic Programming(62. Unique Paths)