C
C#2y ago
xyrile

❔ Binary tree pre order

How to make a loop out of this ?
Tree tree = new Tree();
tree.root = new Node(1);
tree.root.left = new Node(12);
tree.root.right = new Node(9);
tree.root.left.left = new Node(5);
tree.root.left.right = new Node(6);
Tree tree = new Tree();
tree.root = new Node(1);
tree.root.left = new Node(12);
tree.root.right = new Node(9);
tree.root.left.left = new Node(5);
tree.root.left.right = new Node(6);
2 Replies
Ploxi
Ploxi2y ago
Dont work from outside, rather go inside.. Like create a method inside Node which assigns left and right and calls the same method inside the nodes recursion
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.