plan9fox/sys/include/avl.h

27 lines
498 B
C
Raw Normal View History

2016-12-22 22:47:41 +00:00
#pragma lib "libavl.a"
#pragma src "/sys/src/libavl"
2016-12-22 22:47:41 +00:00
typedef struct Avl Avl;
typedef struct Avltree Avltree;
2016-12-22 22:47:41 +00:00
struct Avl {
Avl *c[2];
Avl *p;
schar balance;
};
2016-12-22 22:47:41 +00:00
struct Avltree {
int (*cmp)(Avl*, Avl*);
Avl *root;
};
Avltree *avlinit(Avltree*, int(*)(Avl*, Avl*));
Avltree *avlcreate(int(*)(Avl*, Avl*));
Avl *avllookup(Avltree*, Avl*, int);
2016-12-22 22:47:41 +00:00
Avl *avldelete(Avltree*, Avl*);
Avl *avlinsert(Avltree*, Avl*);
Avl *avlmin(Avltree*);
Avl *avlmax(Avltree*);
2016-12-22 22:47:41 +00:00
Avl *avlnext(Avl*);
Avl *avlprev(Avl*);