Showing posts with label Algorithm. Show all posts
Showing posts with label Algorithm. Show all posts

Thursday, June 11, 2015

Binary tree search logic in pseudo code

  node search (node, key) {
       if node is null then return null;
     
       if node.key = key then
          return node
         
       if key < node then
          return search (node.left, key);
       else
          return search (node.right, key);

Reference:
http://www.codeproject.com/Articles/18976/A-simple-Binary-Search-Tree-written-in-C