src/structures/VecBinaryTree.cpp
// Get the index of a child given the index of the parent
Get the index of a child given the index of the parent
Get the index of a child given the index of the parent
size_t VecBinaryTree::compute_idx(const size_t parent_idx,
            const bchild_t pos) {
        switch (pos) {
            case bchild_t::LEFT:
                return (2 * parent_idx) + 1;
            case bchild_t::RIGHT:
                return (2 * parent_idx) + 2;
            default:
                throw parameter_exception("Unknown child type for binary "
                        "tree", __FILE__, __LINE__);
        }
    }
size_t VecBinaryTree :: compute_idx ( const size_t parent_idx , const bchild_t pos ) { switch ( pos ) { case bchild_t :: LEFT : return ( 2 * parent_idx ) + 1 ; case bchild_t :: RIGHT : return ( 2 * parent_idx ) + 2 ; default : throw parameter_exception ( " " " " , __FILE__ , __LINE__ ) ; } }
Get the index of a child given the index of the parent
Get the index of a child given the index of the parent