Title: Given a binary search tree, find the first of the big K nodes.
def inorder(head,res): p = head if p: inorder(p.left,res) res.append(p.data) inorder(p.right,res) def tree_k(head,k): res = [] inorder(head, res) return res[k-1]
NOTE: The preorder, taken out after the completion of the K-th traversal. The official program is given direct access to the K-th node to stop now do not understand, the latter will be optimized.