diff options
Diffstat (limited to 'increasing_seach_tree.cpp')
-rw-r--r-- | increasing_seach_tree.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/increasing_seach_tree.cpp b/increasing_seach_tree.cpp deleted file mode 100644 index cfe97ec..0000000 --- a/increasing_seach_tree.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - TreeNode *increasingBST(TreeNode *root) { - TreeNode *temp; - TreeNode *ans = new TreeNode(); - temp = ans; - inOrder(ans, root); - return temp->right; - } - -private: - void inOrder(TreeNode *&ans, TreeNode *root) { - if (!root) - return; - inOrder(ans, root->left); - ans->right = new TreeNode(root->val); - ans = ans->right; - inOrder(ans, root->right); - } -}; - -int main() {} |