Inorder Traversal || C++ || Using BST Property
Intuition\n Describe your first thoughts on how to solve this problem. \nIn BST, Inorder travesal gives node\'s values in sorted order.\n# Approach\n Describe y
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn BST, Inorder travesal gives node\'s values in sorted order.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe\'ll store all values into a vector during inorder traversal, and return vec[k-1].\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(H)\n\n# Code\n```\nclass Solution {\npublic:\n   void Inorder(TreeNode* root, vector<int>&vec){\n        if(root == NULL)\n        return;\n      Inorder(root->left,vec);\n      vec.push_back(root->val);\n      Inorder(root->right,vec);\n   }\n    int kthSmallest(TreeNode* root, int k) {\n        vector<int>vec;\n        Inorder(root,vec);\n        return vec[k-1];\n    }\n};\n```
['Tree', 'Depth-First Search', 'Binary Search Tree', 'C++']