Fixed error where best cost could be updated while having pruned nodes
in tree.
Adding pseudocode.