Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

full implementation of binary search tree in C++

Node* search(Node* root, int key) {
        if(root == NULL || root->data == key)        
            return root;

        // Key is greater than root's data 
        if(root->data < key) 
            return search(root->right,key);

        // Key is smaller than root's data 
        return search(root->left,key);
     }
C++Copy
Source by iq.opengenus.org #
 
PREVIOUS NEXT
Tagged: #full #implementation #binary #search #tree
ADD COMMENT
Topic
Name
5+7 =