TEXT   11
Tree forked TreeElementType E
Guest on 11th July 2024 08:37:22 AM


  1. #include <stdio.h>
  2.  
  3. Tree forked(TreeElementType E, Tree L, Tree R)
  4. /* construct the tree <L,E,R> from element E and subtrees L and R.  L.Allison*/
  5.  { Tree T;  T = (Tree)malloc(sizeof(Node));
  6.    T->left  = L;
  7.    T->right = R;
  8.    TreeElementMove(E, &(T->elt));
  9.    return T;
  10.  }/*forked*/
  11.  
  12. int empty(Tree T) { return ( T==NULL ? 1 : 0 ); }
  13.  
  14. Tree left(Tree T)
  15. /* pre: T is not null */
  16.  { return T->left; }
  17.  
  18. Tree right(Tree T)
  19. /* pre: T is not null */
  20.  { return T->right; }
  21.  
  22. /* Some Basic Tree Operation */

Raw Paste

Login or Register to edit or fork this paste. It's free.