hufftree.js
/**
     * Print the entire tree to the console. Not recommended for large trees
     */
Print the entire tree to the console. Not recommended for large trees
Print the entire tree to the console . Not recommended for large trees
dumpTree() {
        let str = "";
        for (let i = 0; i < this.level; i++) {
            str += " ";
        }
        str += this.level + ":";
        if (this.data != undefined) {
            str += this.data;
        }
        console.log(str);
        if (this.left != undefined) {
            this.left.dumpTree();
            this.right.dumpTree();
        }
    }
dumpTree ( ) { let str = "" ; for ( let i = 0 ; i < this . level ; i ++ ) { str += " " ; } str += this . level + ":" ; if ( this . data != undefined ) { str += this . data ; } console . log ( str ) ; if ( this . left != undefined ) { this . left . dumpTree ( ) ; this . right . dumpTree ( ) ; } }
Print the entire tree to the console.
Print the entire tree to the console .