Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

binary tree in c search

 node* search(node ** tree, int val) {
 if(!(*tree)) {
   return NULL;
  }
 if(val == (*tree)->data) {
   return *tree;
  } else if(val < (*tree)->data) {
    search(&((*tree)->left), val);
  } else if(val > (*tree)->data){
    search(&((*tree)->right), val);
  }
 }
Source by www.thegeekstuff.com #
 
PREVIOUS NEXT
Tagged: #binary #tree #search
ADD COMMENT
Topic
Name
8+1 =