void inOrder(TreeNode root, List<Integer> list) {
        if (root == null) return;

        inOrder(root.left, list);

        list.add(root.val);

        inOrder(root.right, list);
    }
This is iterative solution with O(N) space and O(N) time.
get kth element from inorder traversal of Binary search tree.
src/problems/medium/KthSmallestElementinaBST.java