title: Pseudocode - Search Tree
body: <p>I need some help with the following problem. There is a Search Tree (Binary Search Tree) and I need to find a particular element, so to search the Search Tree. But this only needs to be displayed in Pseudocode (so the actual search tree isn't needed, so just for an example the root is 75 and the element that needs to be searched is 24).</p>
  
  <p>So for example step 1: Print Root, 2: Print Tree....(until the correct element has been found). </p>
  
  <p>I have done this so far:</p>
  
  <p>1) def findval (node, lookForElement):<br>
  2) while node is not null:<br>
  3)  if node.val is equal to lookForElement:<br>
  4)        break<br>
  5)   if node.val is less than lookForElement:<br>
  6)       node = node.right<br>
  7)  else:<br>
  8)     node = node.left<br>
  9) return node
  10) if node is null:
  11) print "tree is empty"</p>
  
  <p>But I think this would only work if the the searched element is the next element down, but the searched element could be a few branches down so therefore how would I correctly loop?</p>