Skip to main content
. Author manuscript; available in PMC: 2018 Feb 16.
Published in final edited form as: Mach Learn. 2005 Jun 8;61(1-3):71–103. doi: 10.1007/s10994-005-1123-6
#Initialization
A. Set F[k] ← k + 1 and B[k] ← k − 1, 0 ≤ k < N.
B. Set up two (FIFO) queues, Q1 and Q2, and put all the numbers, 0, …, N − 1, in order into Q1 while Q2 remains empty.
C. Define a marker variable m and a flag.
#Processing
While (Q1 nonempty){
 Set m ← 0.
 While (Q1 nonempty){
  k ← dequeue Q1.
  If(mk){
   Set flag ← 0.
   While (F[k] ≠ N and intervals at k and F[k] are adjacent violators){
    Pool intervals beginning at k and F[k].
    Set uF[F[k]].
    Redefine F[k] ← u.
    If (u < N) redefine B[u] ← k.
    Update mu.
    Update flag ← 1.
   }
  }
  If (flag = 1 and B[k] ≥ 0) enqueue B[k] in Q2.
 }
 Interchange Q1 and Q2.
}