Recursively retract upward from the leaf nodes of the tree.
Suppose that the whole tree before and after a group of leaf nodes retract to its parent node is and , and the corresponding cost function values are and .
(3)
If , pruning is executed, that is, to change the parent node into a new leaf node.
(4)
Return to Step 2 until it cannot continue, and get the subtree with the smallest cost function