I don't think that the C++ version requires more code (well, maybe a few extra lines).
The C++ code that I converted from is part of my personal library of reusable code (I call it "ABLE"). ABLE's _binary_search_tree_base class and the code associated with it have many more features than what I presented in the blog post. I think that the feature that takes up the most room is the iterator support. Also, since I used iterative algorithms instead of recursive ones in many places, the code is longer because of that. Another big user of lines of code is all of the helper functions that I have. Some of the helper functions in the bst base class are never used. I started to code some kind of tree but lost interest, but I left the helper functions in the base class just in case I need them later. I redid the blog post and added better explanations, details, and pictures. Sadly, the new version doesn't use the same base code, so I couldn't leave that tidbit of information in there.
|