We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f32e9aa commit 7b65d6aCopy full SHA for 7b65d6a
src/_DataStructures_/Trees/BST/index.js
@@ -27,6 +27,15 @@ class BinarySearchTree {
27
}
28
return root;
29
30
+
31
+ preorder(root) {
32
+ if (root === null) return;
33
+ // eslint-disable-next-line no-console
34
+ console.log(`${root.value} `);
35
36
+ this.preorder(root.leftChild);
37
+ this.preorder(root.rightChild);
38
+ }
39
40
41
// const bst = new BinarySearchTree(10);
@@ -39,4 +48,6 @@ class BinarySearchTree {
48
49
// console.log(bst.root);
50
51
+// bst.preorder(bst.root);
52
42
53
module.exports = BinarySearchTree;
0 commit comments