karlangadas

TREE: 7TAD

Nov 14th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "arbol.h"
  4.  
  5. void arbolduplicado(TNode *node,TBinaryTree *D){
  6.     if (node==NULL)
  7.         return;
  8.    
  9.     insert(D,node->elem);
  10.     insert(D,node->elem);
  11.    
  12.     arbolduplicado(node->left,D);
  13.     arbolduplicado(node->right,D);
  14.    
  15. }
  16. int main(){
  17.     TBinaryTree T;
  18.     init_tree(&T);
  19.     TBinaryTree D;
  20.     init_tree(&D);
  21.    
  22.     insert(&T,2);
  23.     insert(&T,1);
  24.     insert(&T,3);
  25.    
  26.     preorden(T.root);
  27.     arbolduplicado(T.root,&D);
  28.     printf("\n");
  29.     preorden(D.root);
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment