In an array based implementation of a balanced binary tree, to check a node stor
ID: 3734325 • Letter: I
Question
In an array based implementation of a balanced binary tree, to check a node stored at array[i] is an external node or not, which of the following statement is true?
return true if array[2i+1] and array[2i+2] is null
return true if array[i/2-1] and array[i/2-2] is null
return true if array[i/2-1] or array[i/2-2] is not null
return true if array[2i+1] or array[2i+2] is not null
A)return true if array[2i+1] and array[2i+2] is null
B)return true if array[i/2-1] and array[i/2-2] is null
C)return true if array[i/2-1] or array[i/2-2] is not null
D)return true if array[2i+1] or array[2i+2] is not null
Explanation / Answer
option a) is correct choice.
A node is called external node or leaf node when all of it's child node is zero or if a node has zero children.
When binary tree stored in array then for a node i it's left child will be 2i + 1 and right child will be 2i + 2 and both must be null
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.