diff --git a/problems/0701.二叉搜索树中的插入操作.md b/problems/0701.二叉搜索树中的插入操作.md index 98e60d5f..5cb0de99 100644 --- a/problems/0701.二叉搜索树中的插入操作.md +++ b/problems/0701.二叉搜索树中的插入操作.md @@ -59,7 +59,7 @@ 代码如下: -``` +```cpp TreeNode* insertIntoBST(TreeNode* root, int val) ``` @@ -69,7 +69,7 @@ TreeNode* insertIntoBST(TreeNode* root, int val) 代码如下: -``` +```cpp if (root == NULL) { TreeNode* node = new TreeNode(val); return node; @@ -88,7 +88,7 @@ if (root == NULL) { 代码如下: -``` +```cpp if (root->val > val) root->left = insertIntoBST(root->left, val); if (root->val < val) root->right = insertIntoBST(root->right, val); return root; @@ -120,7 +120,7 @@ public: 那么递归函数定义如下: -``` +```cpp TreeNode* parent; // 记录遍历节点的父节点 void traversal(TreeNode* cur, int val) ```