title: Explanation of merge function
body: <p>I saw some pseudocode in some old exam and I can't really figure out what it's doing.</p>
  
  <p>Can anyone explain it to me?</p>
  
  <p>A and B are BST's.</p>
  
  <pre><code>Foo(A,B)
     if A= NULL
       return B
     if B != NULL
        if value[A] &gt; value[B]
             return Foo(B,A)
        left[B] &lt;- Foo(right[A],left[B])
        right[A] &lt;- B
     return A
  </code></pre>