2

このリンクから、二重配列ツリーによるトライツリーの実装を理解しようとしました。

  1. 衝突すると、再配置する必要があります。check[base[base[s] + c] + d]また、疑似コードから、なぜ更新する必要があるのbase[b+c]でしょうか?

誰でも簡単な言葉で説明できますか?

Procedure Relocate(s : state; b : base_index)
{ Move base for state s to a new place beginning at b }
begin
    foreach input character c for the state s
    { i.e. foreach c such that check[base[s] + c]] = s }
    begin
        check[b + c] := s;     { mark owner }
        base[b + c] := base[base[s] + c];     { copy data }
        { the node base[s] + c is to be moved to b + c;
          Hence, for any i for which check[i] = base[s] + c, update check[i] to b + c }
        foreach input character d for the node base[s] + c
        begin
            check[base[base[s] + c] + d] := b + c
        end;
        check[base[s] + c] := none     { free the cell }
    end;
    base[s] := b
end
4

0 に答える 0