You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.5 KiB

  1. /* avl.h (binary search tree) */
  2. /***********************************************************************
  3. * This code is part of GLPK (GNU Linear Programming Kit).
  4. *
  5. * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
  6. * 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied
  7. * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
  8. * reserved. E-mail: <mao@gnu.org>.
  9. *
  10. * GLPK is free software: you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * GLPK is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  17. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  18. * License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
  22. ***********************************************************************/
  23. #ifndef AVL_H
  24. #define AVL_H
  25. typedef struct AVL AVL;
  26. typedef struct AVLNODE AVLNODE;
  27. #define avl_create_tree _glp_avl_create_tree
  28. AVL *avl_create_tree(int (*fcmp)(void *info, const void *key1,
  29. const void *key2), void *info);
  30. /* create AVL tree */
  31. #define avl_strcmp _glp_avl_strcmp
  32. int avl_strcmp(void *info, const void *key1, const void *key2);
  33. /* compare character string keys */
  34. #define avl_insert_node _glp_avl_insert_node
  35. AVLNODE *avl_insert_node(AVL *tree, const void *key);
  36. /* insert new node into AVL tree */
  37. #define avl_set_node_type _glp_avl_set_node_type
  38. void avl_set_node_type(AVLNODE *node, int type);
  39. /* assign the type field of specified node */
  40. #define avl_set_node_link _glp_avl_set_node_link
  41. void avl_set_node_link(AVLNODE *node, void *link);
  42. /* assign the link field of specified node */
  43. #define avl_find_node _glp_avl_find_node
  44. AVLNODE *avl_find_node(AVL *tree, const void *key);
  45. /* find node in AVL tree */
  46. #define avl_get_node_type _glp_avl_get_node_type
  47. int avl_get_node_type(AVLNODE *node);
  48. /* retrieve the type field of specified node */
  49. #define avl_get_node_link _glp_avl_get_node_link
  50. void *avl_get_node_link(AVLNODE *node);
  51. /* retrieve the link field of specified node */
  52. #define avl_delete_node _glp_avl_delete_node
  53. void avl_delete_node(AVL *tree, AVLNODE *node);
  54. /* delete specified node from AVL tree */
  55. #define avl_delete_tree _glp_avl_delete_tree
  56. void avl_delete_tree(AVL *tree);
  57. /* delete AVL tree */
  58. #endif
  59. /* eof */