Commit Graph

7 Commits

Author SHA1 Message Date
matt efc67dee86 Add a way for a user to know what nodes have changed when a node has been
inserted or removed.  Refactor node insertion to not require rebalancing
all the time or a loop if it does.  In rb_tree_swap_prune_and_rebalance,
don't call rb_tree_reparent_nodes, instead do the work ourselves (since
we will eventually undo half of the work of rb_tree_reparent_nodes).
2006-09-10 23:57:31 +00:00
matt d9bb545dc5 Shrink rb_tree to 4 pointers (2 if RBSMALL is defined). Move compare
functions to a separate rb_tree_ops structure.  Make every int explicit
in being signed or unsigned.  Use RBDEBUG to enable debug code.  Move
rbt_count to RBSTATS.  Use RBSMALL to not keep track of min/max.
2006-09-09 06:52:18 +00:00
matt 75de26ab17 Add rb_tree_find_node_{geq,leq}. Add stats. Make TAILQ DEBUG only.
Keep track of tree's min/max nodes for easier iteration.  Improve comments.
Move functions around to improve locality.
2006-09-09 05:55:51 +00:00
matt 958730091e Fix and simplify node removal. Add lots of assertions and comments. 2006-09-08 04:07:15 +00:00
matt 3aa5e506b7 Rewrite of red-black tree code. 2006-09-05 04:35:45 +00:00
simonb a30355b57a Add RCS ids. 2002-10-08 11:58:54 +00:00
matt 920cfb5205 Add "Red Black +" balanced binary tree routines to libkern. These provide
O(log(N)) insertation, deletion, and lookup times.  However, unlike most
red-black implemenations, this one does no additional memory allocations.
2001-10-24 22:40:56 +00:00