Chain Tree

 int main () { 
 BinTree Tree, parent, Child; 
 char CH [MAXSIZE];
  int I, n-= 0 , K = 0 , J; 
 the printf ( " please assign a binary tree: \ n- " );
  for (I = 0 ; I <MAXSIZE; I ++ ) { 
 Scanf ( " % C " , & CH [I]);
  IF (CH [I] == ' \ n- ' ) BREAK ; 
 } 
 createBinTree (Tree, CH, n-); 
 the printf ( " with generalized table output binary tree: \ n- " ); 
 PrintfBintree (Tree); 
 the printf ( " \ n-" ); 
 The printf ( " leaf node is: \ n- " ); 
 PrintfLeafNode (Tree, K); 
 the printf ( " \ n- " ); 
 the printf ( " the number of leaf nodes is: D% " , K); 
 the printf ( " \ n- " ); 
 the printf ( " Please enter any node: " ); 
 parent = (BiTNode *) the malloc ( the sizeof (BiTNode)); 
 Scanf ( " % C " , & parent-> Data); 
 the printf ( " parent node point:% C " , getParent (Tree, parent) -> Data);
 printf("\ n- " ); 
 Child = (BiTNode *) the malloc ( the sizeof (BiTNode)); 
 the printf ( " Please enter any node: " ); 
 getchar (); 
 Scanf ( " % C " , & Child-> Data); 
 the printf ( " child nodes is: " ); 
 child = Search (Tree, child); 
 printfChild (child); 
 }

 

Guess you like

Origin www.cnblogs.com/Maxsh/p/10986314.html