summaryrefslogtreecommitdiff
path: root/Sources/DataStructure.cpp
AgeCommit message (Collapse)Author
2019-03-12Hashing with Chains done!Haidong Ji
Didn't write test cases because the starter code wasn't easy for testing. Tested using sample input. Fun stuff :)
2019-03-09Phone book done!Haidong Ji
2019-03-05Merging tables done!Haidong Ji
Lots of fun getting this one. I modified the starter code significantly, so it's more like my Java code (I did deviate away with setID as int). I'm happy for 2 things: 1. Learned and practiced again of passing by reference and modifying vector<Table> elements through address 2. Debugging googletests with Eclipse, I tried it and it worked. I had to click forward a few steps before I can really see variables and their changes in the debugger. Very nice :)
2019-02-24Parallel processing job queue done!Haidong Ji
I used C++'s priority_queue (queue.h) and C++'s own pair data structure. Unlike Python and Java's similar data structure, C++'s priority_queue pops in reverse order, so I had to negate the value, and negate back when adding them to vectors. Cool use of pair. Fun stuff :)
2019-02-19Build heap done!Haidong Ji
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!
2019-01-29Network packet done.Haidong Ji
Fun exercise. Good comparison and contrast with Java.
2019-01-15Tree height done in C++!!!Haidong Ji
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!
2019-01-11Tree height partially done.Haidong Ji
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.
2019-01-03Check bracket done!Haidong Ji
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.