Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote