What are the children for node ‘w’ of a complete-binary tree in an array…

2023

What are the children for node ‘w’ of a complete-binary tree in an array representation?

  1. A.

    2w and 2w+1

  2. B.

    2+w and 2-w

  3. C.

    w+1/2 and w/2

  4. D.

    w-1/2 and w+1/2

Attempted by 233 students.

Show answer & explanation

Correct answer: A

Answer: a

Explanation: The left child is generally taken as 2*w whereas the right child will be taken as 2*w+1 because root node is present at index 0 in the array and to access every index position in the array.

Explore the full course: Coding For Placement