checkAncestors(index) {
        let node = this.parent[index];
        while(node !== -1) {
            if(this.treeHash[node]) return false;
            node = this.parent[node];
        }
        return true;
    }
Helper method to check ancestors
Time O(n) | Space O(1)
@param {number} index
@return {boolean}