I think it is better to keep number of nodes you have in a separate variable, so that you can easily remove nodes from the tree while leaving them inside of the vector.
Great point - this code conflates ArenaTree::size() with the length of the vector, which are separate concepts. Your implementation is absolutely more correct.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think it is better to keep number of nodes you have in a separate variable, so that you can easily remove nodes from the tree while leaving them inside of the vector.
Great point - this code conflates
ArenaTree::size()
with the length of the vector, which are separate concepts. Your implementation is absolutely more correct.