# Tutorial D-Heap, Notas de estudo de Informática

5 páginas
1000+Número de visitas
Descrição
Material sobre estrutura de dados D HEAP
30 pontos
este documento
Pré-visualização3 páginas / 5

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

d-ary heap worksheet

Each parent has ___ children, except possibly the parents of the leaves, which have _____ children.

Node index Index of Parent

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

1 / 2 1 3 1 … 1 i 1≤i≤d 1 … 1 d+1 1

d+1+1 … d+1+i … d+1+d

(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 layer1

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 …….

1 2 3 4

root

root

…….

…….

…….

Até o momento nenhum comentário