N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/Vaike/linux/system-addons/networking/avl.h

Go to the documentation of this file.
00001 
00014 /*
00015  * Copyright 2007. Los Alamos National Security, LLC. This material
00016  * was produced under U.S. Government contract DE-AC52-06NA25396 for
00017  * Los Alamos National Laboratory (LANL), which is operated by Los
00018  * Alamos National Security, LLC, for the Department of Energy. The
00019  * U.S. Government has rights to use, reproduce, and distribute this
00020  * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,
00021  * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
00022  * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to
00023  * produce derivative works, such modified software should be clearly
00024  * marked, so as not to confuse it with the version available from LANL.
00025  *
00026  * Additionally, this program is free software; you can redistribute it
00027  * and/or modify it under the terms of the GNU General Public License as
00028  * published by the Free Software Foundation; either version 2 of the
00029  * License, or (at your option) any later version. Accordingly, this
00030  * program is distributed in the hope it will be useful, but WITHOUT ANY
00031  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00032  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
00033  * for more details.
00034  */
00035 
00036 
00037 #ifndef _AVL_H_
00038 # define _AVL_H_
00039 
00040 
00041 struct avlnode {
00042         void *element;
00043         unsigned long key;
00044         struct avlnode *left, *right;
00045         struct avlnode *next, *prev;
00046         unsigned int height;
00047 };
00048 
00049 struct avltree {
00050         struct avlnode *root;
00051         unsigned int size;
00052 };
00053 
00054 
00055 unsigned long avl_size(struct avltree *tree);
00056 struct avlnode *avl_find(unsigned long key, struct avltree *tree);
00057 void *avl_retrieve(unsigned long key, struct avltree *tree);
00058 struct avlnode *avl_find_min(struct avltree *tree);
00059 struct avlnode *avl_find_max(struct avltree *tree);
00060 int avl_insert(void *elt, unsigned long key, struct avltree *tree);
00061 int avl_delete(void *elt, unsigned long key, struct avltree *tree);
00062 void destroy_avltree(struct avlnode *root);
00063 void avl_print(struct avltree *tree);
00064 void avl_print_list(struct avltree *tree);
00065 
00066 
00067 #endif                   /* _AVL_H_ */


© 2007, Los Alamos National Security, LLC.