home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / avltree / avlfind.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-09  |  341 b   |  19 lines

  1. #include <stdio.h>
  2. #include "avl.h"
  3.  
  4. HEADER   *find(root, key, cmp)
  5. HEADER   *root;
  6. HEADER   *key;
  7. int      (*cmp)();
  8. {
  9.    static int relation;
  10.  
  11.    if( !root )
  12.       return NULL;
  13.  
  14.    relation = (*cmp) (key, root+1);
  15.  
  16.    return(relation == 0) ? root + 1 :
  17.       find( relation < 0 ? root->left : root->right, key, cmp );
  18. }
  19.