for i ( 0 .. n ) { f( a[i] ); // the required stuff for a[] f'( b[i] ); // the required stuff for b[] g( a[i], b[i] ); // and whilst we have them, do something to, or accumulate some statistic, that might help the subsequent merge. }