Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1882 clevermous 1
/*
2
 * iAVLTree.h: Header file for AVLTrees with long integer keys.
3
 * Copyright (C) 1998  Michael H. Buselli
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public
16
 * License along with this library; if not, write to the Free
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 *
19
 * The author of this library can be reached at the following address:
20
 * Michael H. Buselli
21
 * 4334 N. Hazel St. #515
22
 * Chicago, IL  60613-1456
23
 *
24
 * Or you can send email to .
25
 * The official web page for this product is:
26
 * http://www.tezcat.com/~cosine/pub/AVLTree/
27
 *
28
 * This is version 0.1.0 (alpha).
29
 */
30
 
31
#ifndef _IAVLTREE_H_
32
#define _IAVLTREE_H_
33
 
34
 
35
typedef struct _iAVLNode {
36
  long key;
37
  long depth;
38
  void *item;
39
  struct _iAVLNode *parent;
40
  struct _iAVLNode *left;
41
  struct _iAVLNode *right;
42
} iAVLNode;
43
 
44
 
45
typedef struct {
46
  iAVLNode *top;
47
  long count;
48
  long (*getkey)(const void *item);
49
} iAVLTree;
50
 
51
 
52
typedef struct {
53
  const iAVLTree *avltree;
54
  const iAVLNode *curnode;
55
} iAVLCursor;
56
 
57
 
58
extern iAVLTree *iAVLAllocTree (long (*getkey)(void const *item));
59
extern void iAVLFreeTree (iAVLTree *avltree, void (freeitem)(void *item));
60
extern int iAVLInsert (iAVLTree *avltree, void *item);
61
extern void *iAVLSearch (iAVLTree const *avltree, long key);
62
extern int iAVLDelete (iAVLTree *avltree, long key);
63
extern void *iAVLFirst (iAVLCursor *avlcursor, iAVLTree const *avltree);
64
extern void *iAVLNext (iAVLCursor *avlcursor);
65
 
66
 
67
#endif