1N/A/*
1N/A *
1N/A * Portions Copyright 1998 Sun Microsystems, Inc. All rights reserved.
1N/A * Use is subject to license terms.
1N/A *
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A/* avl.h - avl tree definitions */
1N/A/*
1N/A * Copyright (c) 1993 Regents of the University of Michigan.
1N/A * All rights reserved.
1N/A *
1N/A * Redistribution and use in source and binary forms are permitted
1N/A * provided that this notice is preserved and that due credit is given
1N/A * to the University of Michigan at Ann Arbor. The name of the University
1N/A * may not be used to endorse or promote products derived from this
1N/A * software without specific prior written permission. This software
1N/A * is provided ``as is'' without express or implied warranty.
1N/A */
1N/A
1N/A
1N/A#ifndef _AVL
1N/A#define _AVL
1N/A
1N/A/*
1N/A * this structure represents a generic avl tree node.
1N/A */
1N/A
1N/Atypedef struct avlnode {
1N/A caddr_t avl_data;
1N/A char avl_bf;
1N/A struct avlnode *avl_left;
1N/A struct avlnode *avl_right;
1N/A} Avlnode;
1N/A
1N/A#define NULLAVL ((Avlnode *) NULL)
1N/A
1N/A/* balance factor values */
1N/A#define LH -1
1N/A#define EH 0
1N/A#define RH 1
1N/A
1N/A/* avl routines */
1N/A#define avl_getone(x) (x == 0 ? 0 : (x)->avl_data)
1N/A#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
1N/Aextern int avl_insert();
1N/Aextern caddr_t avl_delete();
1N/Aextern caddr_t avl_find();
1N/Aextern caddr_t avl_getfirst();
1N/Aextern caddr_t avl_getnext();
1N/Aextern int avl_dup_error();
1N/Aextern int avl_apply();
1N/A
1N/A/* apply traversal types */
1N/A#define AVL_PREORDER 1
1N/A#define AVL_INORDER 2
1N/A#define AVL_POSTORDER 3
1N/A/* what apply returns if it ran out of nodes */
1N/A#define AVL_NOMORE -6
1N/A
1N/Atypedef int (*IFP)();
1N/A
1N/A#endif /* _AVL */