home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 347_01 / tavlsucc.c < prev    next >
C/C++ Source or Header  |  1991-04-27  |  731b  |  34 lines

  1. /*:file:version:date: "%n    V.%v;  %f"
  2.  * "TAVLSUCC.C    V.8;  27-Apr-91,12:08:56"
  3.  *
  4.  *  Module : tavl_succ()
  5.  *  Purpose: Return a pointer to the in-order successor of
  6.  *           the node "p"
  7.  *
  8.  *  Released to the PUBLIC DOMAIN
  9.  *
  10.  *             author:      Bert C. Hughes
  11.  *                          200 N.Saratoga
  12.  *                          St.Paul, MN 55104
  13.  *                          Compuserve 71211,577
  14.  */
  15.  
  16. #include "tavltree.h"
  17. #include "tavlpriv.h"
  18.  
  19. TAVL_nodeptr tavl_succ(TAVL_nodeptr p)
  20. {
  21.     register TAVL_nodeptr q;
  22.  
  23.     if (!p)
  24.         return NULL;
  25.  
  26.     q = p->Rptr;
  27.  
  28.     if (RLINK(p))
  29.         while (LLINK(q))
  30.             q = q->Lptr;
  31.  
  32.     return (Is_Head(q) ? NULL : q);
  33. }
  34.