Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
Slide bài giảng về Red-black trees, bao gồm các cấu trúc dữ liệu như 2-3-4 tree, các phép toán tìm kiếm và chèn, cũng như thư viện Libfdr để cài đặt red-black trees trong C.
正在生成预览...
Red-black trees anhtt-fit@mail.hut.edu.vn Symbol Table Review Symbol table: key-value pair abstraction. Insert a value with specified key. Search for value given key. Delete value with given key. Different implementations Array Linked list BST (binary search tree) 1 Complexity Randomized BST. Guarantee of ~c lg N time per operation (probabilistic). Need subtree count in each node. Need random numbers for each insert/delete op. 2-3-4 tree 2-3-4 tree. Generalize node to allow multiple keys; help to keep tree balanced. Perfect balance. Every path from root to leaf has same length. Allow 1, 2, or 3 keys per node. 2-node: one key, two children. 3-node: two keys, three children. 4-node: three keys, four children. 2 Search Compare search key against keys in node. Find interval containing search key. Ex. Search for L Insert (1) Search to bottom for key. Ex. Insert B 3 Insert (2) 2-node at bottom: convert to 3-node. 3-node at bottom: convert to 4-node. Ex. Insert B Transformation Local transformations should be applied to keep the tree balanced. Ensures that most recently seen node is not a 4-node. Transformations to split 4-nodes: 4 Growth of a tree Growth of a tree (cont.) 5 Complexity Tree height Worst case: lg N [all 2-nodes] Best case: log4 N = 1/2 lg N [all 4-nodes] Between 10 and 20 for a million nodes. Between 15 and 30 for a billion nodes. Red-black tree Represent 2-3-4 tree as a BST. Use "internal" left-leaning edges for 3- and 4- nodes. 1-1 corresponde
… 下载原始文件以阅读完整文档。
- 文档名称
- Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
- 学校 / 课程
- Đại học Bách khoa Hà Nội · Lập trình C
- 作者(文档中)
- AnhTT
- 内容
- Tài liệu trình bày về cây đỏ-đen và cây 2-3-4 như các giải pháp hiệu quả cho bảng ký hiệu, kèm theo các phép biến đổi để cân bằng cây. Nó cũng giới thiệu thư viện Libfdr và cách sử dụng các hàm liên quan.
- 目录
- Symbol Table Review
- Complexity
- 2-3-4 tree
- Search
- Insert (1)
- Insert (2)
- Transformation
- Growth of a tree
- Growth of a tree (cont.)
- Complexity
- Red-black tree
- Red-black tree
- Insert implementation
- Complexity
- Libfdr
- Jval datatype
- RB tree routines
- Quiz 1
- 页数
- 10 页
- 上传者
- lienhejb
常见问题
此文档免费吗?
是的。“Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 10 页,适用于课程 Lập trình C。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。

评论 (0)
暂无评论。快来抢沙发吧!