Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258164
b: refs/heads/master
c: 2f17507
h: refs/heads/master
v: v3
  • Loading branch information
Sasha Levin authored and Linus Torvalds committed Jul 24, 2011
1 parent 35c9392 commit 583cc23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 81d67439855a7f928d90965d832aa4f2fb677342
refs/heads/master: 2f175074e6811974ee77ddeb026f4d21aa3eca4d
23 changes: 14 additions & 9 deletions trunk/Documentation/rbtree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,20 @@ Support for Augmented rbtrees
Augmented rbtree is an rbtree with "some" additional data stored in each node.
This data can be used to augment some new functionality to rbtree.
Augmented rbtree is an optional feature built on top of basic rbtree
infrastructure. rbtree user who wants this feature will have an augment
callback function in rb_root initialized.

This callback function will be called from rbtree core routines whenever
a node has a change in one or both of its children. It is the responsibility
of the callback function to recalculate the additional data that is in the
rb node using new children information. Note that if this new additional
data affects the parent node's additional data, then callback function has
to handle it and do the recursive updates.
infrastructure. An rbtree user who wants this feature will have to call the
augmentation functions with the user provided augmentation callback
when inserting and erasing nodes.

On insertion, the user must call rb_augment_insert() once the new node is in
place. This will cause the augmentation function callback to be called for
each node between the new node and the root which has been affected by the
insertion.

When erasing a node, the user must call rb_augment_erase_begin() first to
retrieve the deepest node on the rebalance path. Then, after erasing the
original node, the user must call rb_augment_erase_end() with the deepest
node found earlier. This will cause the augmentation function to be called
for each affected node between the deepest node and the root.


Interval tree is an example of augmented rb tree. Reference -
Expand Down

0 comments on commit 583cc23

Please sign in to comment.