[Algorithm /인프런] 이진 트리 순회(깊이 우선 탐색)
[전위순회 코드] package section7_recursive_tree_graph; class Node{ int data; Node lt, rt; public Node(int val) { data = val; lt=rt=null; } } public class BinaryTreeSearInorder { Node root; public void DFS(Node root) { //종료 if(root == null) return; else{ System.out.print(root.data+" "); DFS(root.lt); DFS(root.rt); } } public static void main(String[] args) { BinaryTreeSearInorder tree = new BinaryTreeS..
2023.11.07