If a CBT is stored using array , then what is the parent node of element stored at index 11?
Question
If a CBT is stored using array , then what is the parent node of element stored at index 11?
Solution
In a Complete Binary Tree (CBT) stored using an array, the parent node of an element stored at index i can be found using the formula (i-1)/2.
So, for an element stored at index 11, the parent node would be at index (11-1)/2 = 5.
Therefore, the parent node of the element stored at index 11 is at index 5.
Similar Questions
The child of a node at index i are stored at index xi+1 and xi+x. Here x is:
What is the location of parent node for any arbitrary node i?a) (i/2) positionb) (i+1)/ positionc) floor(i/2) positiond) ceil(i/2) position
In an array-based representation of a binary tree, if a node is at index 5, what are the indices of its left and right children?a)Left: 5, Right: 6b)Left: 10, Right: 11c)Left: 6, Right: 7d)Left: 9, Right: 10
In an array-based representation of a binary tree, the root node is stored at index 0.State true or false.a)Trueb)False
In an array-based representation of a binary tree, the root node is stored at index 0.State true or false.a)Falseb)True
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.