The Divide-and-Conquer Subgoal-Ordering Algorithm for Speeding up Logic Inference