Easy Recursive and Iterative Python Solutions
Iterative Solution:\n\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = va
**Iterative Solution:**\n```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:\n        \n        \n        n = 0\n        stack = []\n        curr = root\n        \n        while curr or stack:\n            \n            while curr:\n                stack.append(curr)\n                curr = curr.left\n            \n            curr = stack.pop()\n            n += 1\n            if n == k:\n                return curr.val\n            curr = curr.right\n            \n```\n**Recursive Solution:**\n```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:\n\t\n        self.inorder = []\n        \n        def inorder(root):\n            if not root: return\n            inorder(root.left)\n            self.inorder.append(root.val)\n            inorder(root.right)\n            \n        inorder(root)\n        \n        return self.inorder[k-1]\n```
['Depth-First Search', 'Recursion', 'Iterator', 'Python', 'Python3']