39
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 . 2 1 16 log 1 3

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

Embed Size (px)

Citation preview

Page 1: 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

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

Page 2: 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

4

Chaves:

4

Page 3: 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

4 3

Chaves:

4

Page 4: 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

4 3

Chaves:

3 4

Page 5: 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

4 3 1

Chaves:

3 4

Page 6: 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

4 3 1

Chaves:

1 3 4

Page 7: 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

4 3 1 9

Chaves:

1 3 4

Page 8: 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

4 3 1 9

Chaves:

1 3 4 9

Page 9: 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

4 3 1 9

Chaves:

1 3 9

4

Page 10: 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

4 3 1 9 6

Chaves:

1 3 9

4

Page 11: 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

4 3 1 9 6

Chaves:

1 3 9

4

6

Page 12: 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

4 3 1 9 6 8

Chaves:

1 3 9

4

6

Page 13: 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

4 3 1 9 6 8

Chaves:

1 3 9

4

6 8

Page 14: 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

4 3 1 9 6 8 5

Chaves:

1 3 9

4

6 8

Page 15: 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

4 3 1 9 6 8 5

Chaves:

1 3

4

5 6 9 8

Page 16: 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

4 3 1 9 6 8 5

Chaves:

1 3

4

5 6 9

8

Page 17: 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

4 3 1 9 6 8 5 10

Chaves:

1 3

4

5 6 9

8

Page 18: 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

4 3 1 9 6 8 5 10

Chaves:

1 3

4

5 6 9

8

10

Page 19: 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

4 3 1 9 6 8 5 10 13

Chaves:

1 3

4

5 6 9

8

10

Page 20: 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

4 3 1 9 6 8 5 10 13

Chaves:

1 3

4

5 6 9

8

10 13

Page 21: 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

4 3 1 9 6 8 5 10 13 7

Chaves:

1 3

4

5 6 9

8

10 13

Page 22: 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

4 3 1 9 6 8 5 10 13 7

Chaves:

1 3

4

5 6 9

8

10 137

Page 23: 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

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10 137

Page 24: 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

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10 137 14

Page 25: 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

4 3 1 9 6 8 5 10 13 7 14

Chaves:

1 3

4

5 6 9

8

10

13

7 14

Page 26: 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

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

Chaves:

1 3

4

5 6 9

8

10

13

7 14

Page 27: 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

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

Chaves:

1 3

4

5 6 9

8

10

13

7 142

Page 28: 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

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

Page 29: 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

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

Page 30: 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

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

Page 31: 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

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

Page 32: 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

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

Page 33: 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

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

Page 34: 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

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

Page 35: 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

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

Page 36: 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

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

Page 37: 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

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!

Page 38: 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

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

Page 39: 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

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