summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-12check if binary search tree harder version done!HEADmasterHaidong Ji
Comparing this against my Java and Python code, one more change was needed: key value type changed from int to long. In reality, I'm not sure if int would have worked, but I decided to be better safe than sorry.
2019-06-12Binary Serach Tree check done!Haidong Ji
I was lazy and didn't write test cases for this, because it's more or less a straight copy from Java code, with minor modifications. In the process I forgot to check 0 sized vector, and got "unknown signal 11" segmentation fault error. Easy fix :)
2019-06-09Tree traversal done in C++Haidong Ji
It's not too bad since I worked it out in Java. I didn't use recursive functions at all to avoid stack overflow issues. Instead, I worked it out using loop with stacks and queues. Lots of fun!
2019-03-17Rabin-Karp string search done!Haidong Ji
Good practice of passing by reference again. First time using string compare method in C++. Also I guess I'm luck when I started the Java code using the poly hash function written earlier, therefore I didn't come across the mod negative issue that I read about. Fun stuff :)
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.