Which one of the following is the correct formulae to find the parent node at index I?

Category: QuestionsWhich one of the following is the correct formulae to find the parent node at index I?
Editor">Editor Staff asked 5 months ago

Which one of the following is the correct formulae to find the parent node at index I?
 
(a) (I-1)/K
 
(b) (I+1)/K
 
(c) (I*1)/K
 
(d) (I-2)/K
 
The question is from K-ary Tree in division Trees of Data Structures & Algorithms I
 
I got this question in a national level competition.

1 Answers
Editor">Editor Staff answered 5 months ago

The correct option is (a) (I-1)/K
 
To explain: The parent node for the node of index I in a K-ary tree is given by (I-1)/K.


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40701