Created
July 2, 2019 14:45
-
-
Save verdi327/e2b7315fdbea14ae800d3517889aa7b7 to your computer and use it in GitHub Desktop.
dfs-inorder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inOrder(result=[]) { | |
if (!this.left && !this.right) { | |
return result.push(this.key); | |
} | |
if (this.left) { | |
this.left.inOrder(result); | |
} | |
result.push(this.key); | |
if (this.right) { | |
this.right.inOrder(result); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment