NULL to nullptr

This commit is contained in:
Yudong Jin 2022-11-29 03:21:02 +08:00
parent cce8201e2b
commit 3fc3475af4
2 changed files with 4 additions and 4 deletions

View File

@ -17,9 +17,9 @@ vector<int> hierOrder(TreeNode* root) {
TreeNode* node = queue.front();
queue.pop(); // 队列出队
vec.push_back(node->val); // 保存结点
if (node->left != NULL)
if (node->left != nullptr)
queue.push(node->left); // 左子结点入队
if (node->right != NULL)
if (node->right != nullptr)
queue.push(node->right); // 右子结点入队
}
return vec;

View File

@ -238,9 +238,9 @@ comments: true
TreeNode* node = queue.front();
queue.pop(); // 队列出队
vec.push_back(node->val); // 保存结点
if (node->left != NULL)
if (node->left != nullptr)
queue.push(node->left); // 左子结点入队
if (node->right != NULL)
if (node->right != nullptr)
queue.push(node->right); // 右子结点入队
}
return vec;