Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

recursive tree

// search for target in  a tree using recursive function  
const treeIncludes = (target , root )=>{

if(root===null)return false;
if(root.data===target) return true ;
return treeIncludes(target , root.left ) || treeIncludes(target , root.right );

}
Source by composingprograms.com #
 
PREVIOUS NEXT
Tagged: #recursive #tree
ADD COMMENT
Topic
Name
9+9 =