DEV Community

Mujahida Joynab
Mujahida Joynab

Posted on

Array representation of complete binary tree

Determine Parent to Child Index

Parent Index * 2 + 1 = Left Child Index
Parent Index * 2 + 2 = Right Child Index

Determine Child to Parent Index

(Child Index - 1 ) /2 =Left Parent Index
(Child Index - 2 ) /2 =Right Parent Index

Top comments (0)