Docsity

D-áry Heap: Estrutura de Dados com d Filhos por Nó, Notas de estudo de Informática

Toggle sidebar
bg1
d-ary heap
Each parent has d children, except possibly the parents of the leaves, which have ≤ d
children.
Node index Index of
Parent
Index of Child 1 Index of Child j Index of Child d
1 / 2 1+j 1+d
2 1 d+1+1 d+1+j d+1+d
3 1 2d+1+1 2d+1+j 2d+1+d
… 1
i 1≤i≤d 1 (i-1)d+1+1 (i-1)d+1+j (i-1)d+1+d
… 1
d+1 1
d+1+1 2 (d+1-1)d+1+1 (d+1-1)d+1+d
… 2
d+1+i 2
… 2
d+1+d 2
(kd+1)+1 k
… k
(kd+1)+i k
… k
(kd+1)+d k
pf3
pf4
pf5

Pré-visualização parcial do texto

Baixe D-áry Heap: Estrutura de Dados com d Filhos por Nó e outras Notas de estudo em PDF para Informática, somente na Docsity!

d-ary heap

Each parent has d children, except possibly the parents of the leaves, which have ≤ d children.

Node index Index of Parent

Index of Child 1 Index of Child j Index of Child d

1 / 2 1+j 1+d 2 1 d+1+1 d+1+j d+1+d 3 1 2d+1+1 2d+1+j 2d+1+d … 1 i 1 ≤i≤d 1 (i-1)d+1+1 (i-1)d+1+j (i-1)d+1+d … 1 d+1 1

d+1+1 2 (d+1-1)d+1+1 (d+1-1)d+1+d … 2 d+1+i 2 … 2 d+1+d 2

(kd+1)+1 k … k (kd+1)+i k … k (kd+1)+d k

1 node at layer 0

d nodes at layer 1

d^2 nodes at layer 2

d^h nodes at layer h

d d d d ……. children children of children of node 2 of the root node 1 in layer1 in layer

1 2 3 4 d+1 d+1+1 d+1+d

___ node at layer 0

___ nodes at layer 1

___ nodes at layer 2

___ nodes at layer h

d d d d …….

root

root

…….

…….

…….