Age | Commit message (Collapse) | Author |
|
It turned out it's more challenging converting Java code to C++ this
time. The for loop, commented in the code, was tricky! The while loop
was better anyway. It was good practice of doing debugging with gdb.
Once again, rewarding experience!
|
|
Fun exercise. Good comparison and contrast with Java.
|
|
Wow, this is so frustrating at times but in the end so much fun!!! My
real issue was creating and using a member function called getChildren,
which returns a node's children. It turned out if I accessed the
children member variable directly (since it's public), problem solved!
Another somewhat interesting observation is that using "vector<Node>" in
the main getHeight function seems slightly more efficient (memory wise)
than "vector<Node*>". I also used Visual Studio Community C++ 2017,
which was cool as well!
|
|
Partially because it didn't pass time limitations for test case 19 out
of 24. I suspect it's pointer reference stuff that was the cause of the
issue. Checking in for now, I need to research and learn more and will
tackle this again so it passes all tests.
|
|
Implementation isn't difficult since I worked the algo out in Java and
Python already. I tried to use VS Code to write this but in the end
decided to stick with Eclipse. Doing this in VS Code may not be worth
the investment.
|