00001
00010 /*00011 * Copyright 2007. Los Alamos National Security, LLC. This material00012 * was produced under U.S. Government contract DE-AC52-06NA25396 for00013 * Los Alamos National Laboratory (LANL), which is operated by Los00014 * Alamos National Security, LLC, for the Department of Energy. The00015 * U.S. Government has rights to use, reproduce, and distribute this00016 * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,00017 * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL00018 * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to00019 * produce derivative works, such modified software should be clearly00020 * marked, so as not to confuse it with the version available from LANL.00021 *00022 * Additionally, this program is free software; you can redistribute it00023 * and/or modify it under the terms of the GNU General Public License as00024 * published by the Free Software Foundation; either version 2 of the00025 * License, or (at your option) any later version. Accordingly, this00026 * program is distributed in the hope it will be useful, but WITHOUT ANY00027 * WARRANTY; without even the implied warranty of MERCHANTABILITY or00028 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License00029 * for more details.00030 */00031
00032
00033 #ifndef _AVL_H_00034 #define _AVL_H_00035
00036 #ifdef __cplusplus00037 extern"C" {
00038 #endif00039
00040
00041typedefstruct avltree {
00042struct avlnode *root;
00043unsignedintsize;
00044 } avl_tree_t;
00045
00046
00047 unsignedlongavl_size(avl_tree_t *tree);
00048 void *avl_find(unsignedlongkey, avl_tree_t *tree);
00049 void *avl_find_min(avl_tree_t *tree);
00050 void *avl_find_max(avl_tree_t *tree);
00051 intavl_insert(void *element, unsignedlongkey, avl_tree_t *tree);
00052 intavl_delete(void *element, unsignedlongkey, avl_tree_t *tree);
00053 voiddestroy_avltree(avl_tree_t *tree);
00054 voidavl_print(avl_tree_t *tree);
00055 voidavl_print_list(avl_tree_t *tree);
00056
00057
00058 #ifdef __cplusplus00059 }
00060 #endif00061
00062 #endif // _AVL_H_