Method: binary tree search feature is less than the left node tree, the tree node is less than the right, so the method using the preorder ordered sequence can be obtained
BinaryTreeNode KthNode(BinaryTreeNode pNode ,int k){ if( pNode ==null||k==0) return null; return KthNodeCore(pNode ,k ); } BinaryTreeNode KthNodeCore(BinaryTreeNode pNode ,int k ){ Target BinaryTreeNode = null ; // traversal recursion starts to a minimum IF (pNode.L =! Null ) target = KthNodeCore (pNode.L, K); // K as a condition IF (target == null ) { IF (K ==. 1 ) target=pNpde; k--; } if( target==null && pNode.R==null) target=KthNodeCore(pNode.R ,k ); return target; }