diff options
author | David du Colombier <0intro@gmail.com> | 2011-06-02 13:43:02 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2011-06-02 13:43:02 -0400 |
commit | e63f0507e907041e62ccc81ee518ea5426a8fd2a (patch) | |
tree | 98ddb8ada469458ba55fea8c775af067c4f1fb65 /man/man3 | |
parent | f5a8ea6fd8908c6f42670b8546239fdbc7fdbf03 (diff) | |
download | plan9port-e63f0507e907041e62ccc81ee518ea5426a8fd2a.tar.gz plan9port-e63f0507e907041e62ccc81ee518ea5426a8fd2a.tar.bz2 plan9port-e63f0507e907041e62ccc81ee518ea5426a8fd2a.zip |
avl(3): import changes from plan 9
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/4536105
Diffstat (limited to 'man/man3')
-rw-r--r-- | man/man3/avl.3 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/man/man3/avl.3 b/man/man3/avl.3 index f87fd97c..e2545f0a 100644 --- a/man/man3/avl.3 +++ b/man/man3/avl.3 @@ -24,6 +24,7 @@ void deleteavl(Avltree *tree, Avl *key, Avl **oldp); void endwalk(Avlwalk *walk); void insertavl(Avltree *tree, Avl *new, Avl **oldp); Avl *lookupavl(Avltree *tree, Avl *key); +Avl *searchavl(Avltree *tree, Avl *key, int neighbor); Avltree *mkavltree(int(*cmp)(Avl*, Avl*)); .EE .SH DESCRIPTION @@ -60,6 +61,32 @@ comparison function, or .B nil if none. +.PP +.I Searchavl +returns the +.I tree +node that matches +.I key +by +.IR tree 's +comparison function, if it exists. +If it does not, and +.I neighbor +is positive, it returns the nearest node whose +.I key +is greater or +.B nil +if there is none and, if +.I neighbor +is negative, it returns the nearest node whose +.I key +is less or +.B nil +if there is none. +It is an error to set +.I neighbor +to values other than \-1, 0, or +1. +.PP .I Deleteavl removes the node matching .I key |