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.
Vorschau wird generiert...
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
… Laden Sie die Originaldatei herunter, um das vollständige Dokument zu lesen.
- Dokumentenname
- Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT
- Schule / Kurs
- Đại học Bách khoa Hà Nội · Lập trình C
- Autor (im Dokument)
- AnhTT
- Inhalt
- 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.
- Inhaltsverzeichnis
- 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
- Seiten
- 10 Seiten
- Hochgeladen von
- lienhejb
Häufig gestellte Fragen
Ist dieses Dokument kostenlos?
Ja. „Lập trình C nâng cao - Fit Lec 4 (HUST) GV.AnhTT“ ist kostenlos — melden Sie sich einfach an und klicken Sie auf Herunterladen, um die Originaldatei zu erhalten.
Wie viele Seiten hat dieses Dokument?
Das Dokument hat 10 Seiten, für den Kurs Lập trình C. Sie können es vor dem Herunterladen online in der Vorschau ansehen.
Kann ich vor dem Herunterladen eine Vorschau ansehen?
Ja. Sie können sich dieses Dokument direkt auf dieser Seite im Online-Reader ansehen und dann entscheiden, ob Sie es herunterladen möchten.

Kommentare (0)
Noch keine Kommentare. Seien Sie der Erste!