Question about solution 9.10 in v1.4.11

#1

Hello,

When I read the solution of 9.10 of v1.4.11, I have a question about the “continue” clause under the if(!curr) statement. Using this continue, the program bypassed the nullptr elements in the precessing_nodes, but also bypassed the “cout << endl” in the depth level checking section. Then, the format of the output could be wrong, if at a certain depth, the last possible node is empty (such as depth 4 in figure 10.1). Did I understand this correctly?

Thank you
-Wuyang

0 Likes

#2

Hey Wuyang,

Thanks for your report, and I just verified that it actually a bug introduced recently. I have fixed it and you should be able to see the changes at https://github.com/epibook/epibook.github.io/blob/master/solutions/cpp/Binary_tree_level_order.cc

Please let us know if there is any problem.

0 Likes

#3

Hi Tsung-Hsien,

I just read through you new codes and they look correct to me.
Thank you for responding to me.

Best,
-Wuyang

0 Likes