title: recursion to explicit stack
body: <p>I am trying to convert this recursive algorithm in an iterative one, it is the ida A* algorithm (from wikipedia). I have implemented it and the iterative version doesn't return the same result as the recursive version.</p>
  
  <pre><code> function search(node, bound)
     if state.f &gt; bound then return state.f
     if is_goal(node) then return FOUND
     min := ∞
     for succ in successors(node) do
       t := search(succ, bound)
       if t = FOUND then return FOUND
       if t &lt; min then min := t
     end for
    return min
   end function
  </code></pre>
  
  <p>First attempt</p>
  
  <pre><code> function search(node, bound)
     stack = new Stack()
     stack.push(node)
     while(!stack.empty())
       state = stack.pop()
       min := ∞
       if state.f &gt; bound then 
         if state.f &lt; min then min := state.f
         continue
       if is_goal(node) then return FOUND
       for succ in successors(node) do
         stack.push(succ)
       end for
     return min
    end function
  </code></pre>