Skip to content

Commit 894e3d5

Browse files
authored
Update array_binary_tree.cpp (#1568)
打印的小错误
1 parent 14608d4 commit 894e3d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

codes/cpp/chapter_tree/array_binary_tree.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ int main() {
115115
int i = 1;
116116
int l = abt.left(i), r = abt.right(i), p = abt.parent(i);
117117
cout << "\n当前节点的索引为 " << i << ",值为 " << abt.val(i) << "\n";
118-
cout << "其左子节点的索引为 " << l << ",值为 " << (l != INT_MAX ? to_string(abt.val(l)) : "nullptr") << "\n";
119-
cout << "其右子节点的索引为 " << r << ",值为 " << (r != INT_MAX ? to_string(abt.val(r)) : "nullptr") << "\n";
120-
cout << "其父节点的索引为 " << p << ",值为 " << (p != INT_MAX ? to_string(abt.val(p)) : "nullptr") << "\n";
118+
cout << "其左子节点的索引为 " << l << ",值为 " << (abt.val(l) != INT_MAX ? to_string(abt.val(l)) : "nullptr") << "\n";
119+
cout << "其右子节点的索引为 " << r << ",值为 " << (abt.val(r) != INT_MAX ? to_string(abt.val(r)) : "nullptr") << "\n";
120+
cout << "其父节点的索引为 " << p << ",值为 " << (abt.val(p) != INT_MAX ? to_string(abt.val(p)) : "nullptr") << "\n";
121121

122122
// 遍历树
123123
vector<int> res = abt.levelOrder();

0 commit comments

Comments
 (0)