4.5 Dynamic indexing 79
LMERGEADDTOKEN(indexes, Z0, token)
1 Z0 ← MERGE(Z0, {token})
2 if |Z0| = n
3 then for i ← 0 to ∞
4 do if Ii ∈ indexes
5 then Zi+1 ← MERGE(Ii
, Zi)
6 (Zi+1
is a temporary index on disk.)
7 indexes ← indexes − {Ii}
8 else Ii ← Zi
(Zi becomes the permanent index Ii
.)
9 indexes ← indexes ∪ {Ii}
10 BREAK
11 Z0 ← ∅
LOGARITHMICMERGE()
1 Z0 ← ∅ (Z0 is the in-memory index.)
2 indexes ← ∅
3 while true
4 do LMERGEADDTOKEN(indexes, Z0, GETNEXTTOKEN())