Escolar Documentos
Profissional Documentos
Cultura Documentos
rvores Patrcias
1 0 1
S6
0 0 1
UFRGS
INF01124
0 1 0 1
S5
S1
1
S2
S3
S4
4
Que tipo de rvore temos ? rvore Binria de Prefixo : nenhuma chave prefixo de outra
0 1
S6
1 0 1 0 0 0 1
S6
0 1
S5
0 1 0 1
S5
0 1 0 1
S1 S4
2
S2
S3
S4
5
S1
S2
S3
Eliminando os ziguezagues
S6
1 0 1 1 0 0 1 0 0 0 1 0 1
S5
0 1 0 1 0 1 0 1
S5 S4
S1
S2
S3
S1
3
S2
S3
S4
6
rvore Patrcia
1
0 1
4
0 1 0
2
1
S1
S2
0
4
1
S5
S3
S4
rvore Patrcia
rvore digital binria de prefixo obtida pela eliminao dos ziguezagues Rtulos nos respectivos ns em que iniciam os ziguezagues eliminados
begin if esq(p) = nill then if x = r(p) then a:= 1 else a;= 2 else if k < r(p) then a:=2 else if d[r(p)] = 0 then begin p:= esq (p); peqpat (x, p, a); end else begin p:= dir(p); pesqpat (x, p, a); end end;
9