Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
- Pages
- 10
- Format
- Size
- 383 KB
- Trường
- Đại học Bách khoa Hà Nội
- Views
- 0
- Comments
- 0
- Lượt tải
- 0
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.
Frequently asked questions
Is this document free?
Yes. “Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT” is free — just sign in and click Download to get the original file.
How many pages is this document?
The document has 10 pages, for the course Lập trình C. You can preview it online before downloading.
Can I preview before downloading?
Yes. You can preview this document right on this page with the online reader, then decide whether to download.
- Document name
- Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
- School / Course
- Đại học Bách khoa Hà Nội · Lập trình C
- Author (in document)
- AnhTT
- Content
- 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.
- Table of contents
- 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
- Pages
- 10 pages
- Uploaded by
- lienhejb
Generating preview...
Description
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
Generating preview...
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
Read full document
- Document name
- Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
- School / Course
- Đại học Bách khoa Hà Nội · Lập trình C
- Author (in document)
- AnhTT
- Content
- 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.
- Table of contents
- 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
- Pages
- 10 pages
- Uploaded by
- lienhejb
Comments (0)
No comments yet. Be the first!
Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT
Lập trình C nâng cao - Fit Lec 8 (HUST) GV.AnhTT
Lập trình C nâng cao - Fit Lec 5 (HUST) GV.AnhTT
Slide Lập trình C nâng cao - Fit Lec 11 (HUST) GV.AnhTT
Lập trình C nâng cao - Fit Lec 3 (HUST) GV.AnhTT
K5 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K2 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K3 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K4 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K1 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
Comments (0)
No comments yet. Be the first!