1 votes 1 votes What is the location of parent node for any arbitrary node $i$ in an array implementation of a complete binary tree in C language? floor$(i /2)$ floor$(i+1) /2$ floor$((i-1)/2)$ ceil$((i-1)/2)$ DS go2025-ds-1 binary-heaps + – gatecse asked Aug 9, 2020 gatecse 309 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 5 votes 5 votes In C language array index starts from $0.$ Parent of any node $i$ of a complete binary tree is given by floor$((i-1)/2).$ gatecse answered Aug 9, 2020 • selected Aug 8, 2021 by Arjun gatecse comment Share Follow See all 9 Comments See all 9 9 Comments reply Show 6 previous comments Arjun commented Aug 24, 2022 reply Follow Share yes 0 votes 0 votes Sahil_Lather commented Dec 28, 2023 reply Follow Share I confused between the indexing 0 or 1 , i think it should be mentioned explicitly. 0 votes 0 votes parth023 commented Jan 7 reply Follow Share @Sahil_Lather array implementation in c usually starts from 0. 0 votes 0 votes Please log in or register to add a comment.