Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

binary tree inOrder method with JavaScript

inOrder() {
        let result = [];

        let recursive = (node) => {
            if (node.left) {
                recursive(node.left);
            }
            result.push(node.value);

            if (node.right) {
                recursive(node.right);
            }
        }

        recursive(this.root);

        return result;
    }
//if you find the answer is useful ,
//upvote for it, so can the others benefit also ༼ つ ◕_◕ ༽つ @mohammad alshraideh ( ͡~ ͜ʖ ͡°)⇑⇑
Source by github.com #
 
PREVIOUS NEXT
Tagged: #binary #tree #inOrder #method #JavaScript
ADD COMMENT
Topic
Name
6+6 =