title: Time Complexity of printing BST using inorder successor method
body: <p>I have a method for finding the next inorder successor within a Binary Search Tree (BST). The "inorderSuccessor" method takes any node of the BST as input and output the next inorder successor. The method and tree class are defined as follow:</p>
  
  <pre><code>class BSTInorderSuccessor{
    public static Node inorderSuccessor(Node node) {
      if (node.right != null) {
        return minValue(node.right);
      }
      Node parent = node.parent;
      while (parent != null &amp;&amp; node == parent.right){
        node = parent;
        parent = parent.parent;
      }
      return parent;
    }
  }
  
  class TreeNode{
    int data;
    Node left;
    Node right;
    Node parent;
    public TreeNode(int data){
      this.data = data;
      this.left = null;
      this.right = null;
      this.parent = null;
    }
  }
  </code></pre>
  
  <p>Suppose the height of the BST is h, and there are n nodes within this tree structure. I know that the time complexity of "inorderSuccessor" method is O(h). </p>
  
  <p>My question is: Given the smallest node of the BST. When I write a method to continuously call "inorderSuccessor" to print all the nodes of the BST, what is the total time complexity? I think it is O(n * h). Is that correct?</p>