Algorithm 6 : The Divide-and-Conquer Algorithm Order( o)
let   Root Cand Set CandidateSet( o eturn Unfold(the cheapest element of RootCandSet)
Candidate Set (
D Part (
let 1 2 k case 1, shared-vars( 1)
is independent under
(
eturn   Sort-by-cn( 1, shared-vars( 1)
is indivisible under
(
loop for CandidateSet( let C ( )
let C ( )
Fold( A
eturn U A SC (
1 (  is divisible under loop for 1 to CandidateSet( ;
let C i eturn {Merge( Cl C
l 2 2 Me rge (
l 2 k
(first ma  block( i ))  , 1 let min-cn-candidate         that minimi es let min-cn-block   first ma  block( min-cn-candidate )
remove first ma  block( min-cn-candidate )
eturn min-cn-block Merge( min-block )
l 2 k Fold (
2 i f l or 2) IIA1
( 1)
(
then eturn l 2 else if the last subgoal of 1 and the first subgoal of 2 satisf the ad acenc restriction t hen let block(  1 2)
eturn Fold( 3 else eturn ig ure 1 The revised version of the DAC algorithm. The candidate sets are built selectively, without explicit creation of consistency sets. Candidate sets contain folded orderings, and unfolding is performed only on the returned global ordering.  The code of the Unfold and Sort-by-cn procedures is not listed, due to its straightforwardness. The merging procedure recursively extracts from the given folded orderings max-blocks that are minimal by cn. The folding procedure joins two leading blocks into a larger one, as long as they are cn-inverted.