I have the following code for the BST for the inorder, postorder, preorder, breadth first and depth first traversals. Can you review and let me know the optimisation points and issues, if any?import java.util.ArrayDeque;import java.util.Queue;import java.util.Scanner;import java.util.Stack;public class BST {    static class Node {        int data;        Node right, left;        Node(int data) {            this.data = data;            right = left = null;        }        @Override        public String toString() {            return Node [data= + data + , right= + right + , left= + left + ];        }    }    public static void preOrder(Node root) {        if (root != null) {            System.out.print(root.data +  );            preOrder(root.left);            preOrder(root.right);        }    }    public static void inOrder(Node root) {        if (root != null) {            inOrder(root.left);            System.out.print(root.data +  );            inOrder(root.right);        }    }    public static void postOrder(Node root) {        if (root != null) {            postOrder(root.left);            postOrder(root.right);            System.out.print(root.data +  );        }    }    public static void breadthFirstTraversal(Node root) {        Queue<Node> queue = new ArrayDeque<Node>();        if (root != null) {            queue.add(root);        }        while (!queue.isEmpty()) {            Node node = queue.remove();            System.out.print(node.data +  );            if (node.left != null) {                queue.add(node.left);            }            if (node.right != null) {                queue.add(node.right);            }        }    }    public static void depthFirstTraversal(Node root) {        Stack<Node> stack = new Stack<Node>();        if (root != null) {            stack.push(root);        }        while (!stack.isEmpty()) {            Node node = stack.pop();            System.out.print(node.data +  );            if (node.right != null) {                stack.push(node.right);            }            if (node.left != null) {                stack.push(node.left);            }        }    }    public static Node insert(Node node, int data) {        if (node == null) {            return new Node(data);        }        Node cur;        if (data <= node.data) {            cur = insert(node.left, data);            node.left = cur;        } else {            cur = insert(node.right, data);            node.right = cur;        }        return node;    }    public static void main(String args[]) {        BST bst = new BST();        Scanner sc = new Scanner(System.in);        int t = sc.nextInt();        Node root = null;        while (t-- > 0) {            int data = sc.nextInt();            root = insert(root, data);        }        System.out.println(Preorder :);        preOrder(root);        System.out.println(\nInOrder );        inOrder(root);        System.out.println(\nPostOrder );        postOrder(root);        System.out.println(\nBreadth First Traversal );        breadthFirstTraversal(root);        System.out.println(\nDepth First Traversal );        depthFirstTraversal(root);    }}
Binary search traversal with in/pre/post order and BFS/DFS
java;tree