(New page: Shiyu Wang Lec28 April 27th typedef struct treenode { struct treenode *left; struct treenode *right; int value; }Node; Node* root=NULL; root=tree_insert(root,13); root=tree_inser...)
(No difference)

Revision as of 18:00, 27 April 2012

Shiyu Wang Lec28 April 27th

typedef struct treenode {

 struct treenode *left;
 struct treenode *right;
 int value;

}Node;

Node* root=NULL;

root=tree_insert(root,13);

root=tree_insert(root,7);

root=tree_insert(root,22);

Node*Tree_insert(Node*n,int v) {

 if(n==NULL)
 {
   return Node_construct(v);
 }
 if((n->value)==v)
 {
   return n;
 }
 if((n->value)>v)
 {
   n->left=Tree_insert(n->left,v);
 }
 else
 {
   n->right=Tree_insert(n->right,v);
 }
 return n;

}

Alumni Liaison

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva