Sail E0 Webinar
Question

A d-ary heap is a like a binary heap, but (with one possible exception)
non-leaf nodes have d children instead of 2 children. What would be
the procedures to map a node with index i to its parent and its jth
child, given the heap is represented using an array.



Options:
A .  PARENT(i):return floor((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i - 1) + j + 1
B .  PARENT(i):return ceil((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i) + j
C .  PARENT(i):return floor((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i) + j + 1
D .  PARENT(i):return ceil((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i - 1) + j
Answer: Option A



Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers