chaves: 4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20 Árvore-b com 3 chaves por página

Post on 17-Apr-2015

106 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Chaves: 4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20

Árvore-B com 3 chaves por página

mínimos níveis 3 043.2116log 13

4

Chaves:

4

4 3

Chaves:

4

4 3

Chaves:

3 4

4 3 1

Chaves:

3 4

4 3 1

Chaves:

1 3 4

4 3 1 9

Chaves:

1 3 4

4 3 1 9

Chaves:

1 3 4 9

4 3 1 9

Chaves:

1 3 9

4

4 3 1 9 6

Chaves:

1 3 9

4

4 3 1 9 6

Chaves:

1 3 9

4

6

4 3 1 9 6 8

Chaves:

1 3 9

4

6

4 3 1 9 6 8

Chaves:

1 3 9

4

6 8

4 3 1 9 6 8 5

Chaves:

1 3 9

4

6 8

4 3 1 9 6 8 5

Chaves:

1 3

4

5 6 9 8

4 3 1 9 6 8 5

Chaves:

1 3

4

5 6 9

8

4 3 1 9 6 8 5 10

Chaves:

1 3

4

5 6 9

8

4 3 1 9 6 8 5 10

Chaves:

1 3

4

5 6 9

8

10

4 3 1 9 6 8 5 10 13

Chaves:

1 3

4

5 6 9

8

10

4 3 1 9 6 8 5 10 13

Chaves:

1 3

4

5 6 9

8

10 13

4 3 1 9 6 8 5 10 13 7

Chaves:

1 3

4

5 6 9

8

10 13

4 3 1 9 6 8 5 10 13 7

Chaves:

1 3

4

5 6 9

8

10 137

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10 137

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10 137 14

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10

13

7 14

4 3 1 9 6 8 5 10 13 7 14 2

Chaves:

1 3

4

5 6 9

8

10

13

7 14

4 3 1 9 6 8 5 10 13 7 14 2

Chaves:

1 3

4

5 6 9

8

10

13

7 142

4 3 1 9 6 8 5 10 13 7 14 2 18

Chaves:

1 3

4

5 6 9

8

10

13

7 142

4 3 1 9 6 8 5 10 13 7 14 2 18

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18

4 3 1 9 6 8 5 10 13 7 14 2 18 19

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18

4 3 1 9 6 8 5 10 13 7 14 2 18 19

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18 19

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18 19

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18 1911

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18 1911

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18 1911 20

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18

19

11 20

4 3 1 9 6 8 5 10 13 7 14 2 18 19 11 20

Chaves:

1 3

4

5 6 9

8

10

13

7 142 18

19

11 20

FIM!

Estrutura das páginas

D H K

A B C E G I J L M

0 3 8 5

2

3 D H K 0 3 8 5

contador de chaves

chaves filhos

Página 2

2 E G NIL NIL NIL NILPágina 3

RRN

FUNCTION busca (RRN, CHAVE, ACHEI-RRN, ACHEI-POS)

if RRN = NIL then /* para a recursão */

return NAO-ACHEI

else

carregue a página indicada por RRN em PAGE

procure a CHAVE em PAGE

POS = posição onde CHAVE ocorre ou devia ocorrer

if CHAVE encontrada then

ACHEI-RRN = RRNACHEI-POS = POSreturn ACHEI

else /* desçe um nível na direção do FILHO */

return(busca(PAGE.FILHO[POS], CHAVE, ACHEI-RRN, ACHEI-POS))endif

endifend FUNCTION

top related