mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-25 12:36:30 +08:00
NULL to nullptr
This commit is contained in:
parent
cce8201e2b
commit
3fc3475af4
2 changed files with 4 additions and 4 deletions
|
@ -17,9 +17,9 @@ vector<int> hierOrder(TreeNode* root) {
|
||||||
TreeNode* node = queue.front();
|
TreeNode* node = queue.front();
|
||||||
queue.pop(); // 队列出队
|
queue.pop(); // 队列出队
|
||||||
vec.push_back(node->val); // 保存结点
|
vec.push_back(node->val); // 保存结点
|
||||||
if (node->left != NULL)
|
if (node->left != nullptr)
|
||||||
queue.push(node->left); // 左子结点入队
|
queue.push(node->left); // 左子结点入队
|
||||||
if (node->right != NULL)
|
if (node->right != nullptr)
|
||||||
queue.push(node->right); // 右子结点入队
|
queue.push(node->right); // 右子结点入队
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
|
|
|
@ -238,9 +238,9 @@ comments: true
|
||||||
TreeNode* node = queue.front();
|
TreeNode* node = queue.front();
|
||||||
queue.pop(); // 队列出队
|
queue.pop(); // 队列出队
|
||||||
vec.push_back(node->val); // 保存结点
|
vec.push_back(node->val); // 保存结点
|
||||||
if (node->left != NULL)
|
if (node->left != nullptr)
|
||||||
queue.push(node->left); // 左子结点入队
|
queue.push(node->left); // 左子结点入队
|
||||||
if (node->right != NULL)
|
if (node->right != nullptr)
|
||||||
queue.push(node->right); // 右子结点入队
|
queue.push(node->right); // 右子结点入队
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
|
|
Loading…
Reference in a new issue