title: Precessor and successor in Binary Tree
body: <p>I wanted to implement 2 codes, one for the biggest successor of x and one for the smallest predecessor of x in a binary tree.</p>
  
  <pre><code>data LookupTree a = Blatt  | Knoten a (LookupTree a) (LookupTree a)
  biggestSucc :: Ord a =&gt; a -&gt; LookupTree a -&gt; Int
  biggestSucc x Blatt = error "Am Knoten"
  biggestSucc x (Knoten a l r)
      |a == x = max l r
      |a /= x = biggestSucc x _
  
  smallestPre :: Ord a =&gt; a -&gt; LookupTree a -&gt; Int
  smallestPre x Blatt = error "Am Knoten"
  smallestPre x (Knoten a l r)
      |a == x = 
      |a /= x = smallestPre x _
  </code></pre>
  
  <p>The problem is the <code>max</code> and <code>min</code> function and the <code>smallestPre</code>/<code>biggestSucc x _</code> thing. But how else can I tell him to go on in both directions of the node? Thanks!</p>