summaryrefslogtreecommitdiff
path: root/src/main
AgeCommit message (Collapse)Author
2019-09-04Salvaged SetRangeSum from the grader and test checkin. The long storyHaidong Ji
is that I rebuilt the machine from Manjaro to Deepin then back to Manjaro again. Unfortunately I lost the test file, which I'll recreate.
2019-06-12"is it binary search tree hard" done!Haidong Ji
not too bad, just allowing the right node being equal or greater. Two modifications to the code was needed.
2019-06-11"is it binary search tree" done!Haidong Ji
This is not too bad. Since I got the tree traversal done in the last exercise, I just used the in-order traversal as a base and modified a bit.
2019-06-09woohoo, tree order traversal done!Haidong Ji
Once again a lot of fun. I had about 3 months hiatus due to house purchasing, where I didn't touch this exercise, more or less. Today I made an effort following TDD and got the last post order traversal done! I worried if edx/course staff stopped the auto grader. It turned out they didn't. Really happy :)
2019-03-23check in post-order test casesHaidong Ji
2019-03-22In-order and pre-order binary tree traversal doneHaidong Ji
I worked this out myself, using iterative approach instead of recursive to avoid stack overflow issues. Post-order traversal not done yet. I'll likely follow pseudo code from this wiki page to get that done: https://en.wikipedia.org/wiki/Tree_traversal
2019-03-16Rabin-Karp string search done!Haidong Ji
Fun exercise. Some takeaways: 1. Smallest test case is easy to walk through and verify the logic, indexing, and such is correct; 2. Persist, don't give up, take it step by step, and you'll reach the goal! Hooray!
2019-03-10Hash chain simulation done!Haidong Ji
Created test cases for the hash function. Tested the code by running the main function without writting test cases. I wish the starter code was written in a way that facilitated testing...
2019-03-09Phone book done!Haidong Ji
I cheated and didn't modify the starter code so it's testable. It seems that starter code in this course is not written as well as the first course.
2019-03-03Merging tables done!Haidong Ji
Another interesting problem to solve. I gained a much better understanding of disjoint sets (aka Union/Find) through the coding challenge. A few takeaways: 1. Writing test cases is so important. I can sink my teeth into it and have something concrete to work on, instead of wasting time beating around the bush; 2. Modify starter code to make it testable, if it's not easy to test to begin with; 3. Get started early, so I can use my "sleep on it" technique. It really improves understanding! 4. I'm slightly bothered by the fact that I don't have a test case to catch the issue with grader test case 8. I looked at the code and added line 61 which enabled me to pass the grader.
2019-02-21Parallel processing job queue done!Haidong Ji
Fun exercise. Facing a difficult problem, always take small/concrete and concrete steps, and you'll get there! Writing down pseudo code helped, along with creating a subclass implementing the Comparable interface. Good thing that I've done that before and have example to follow.
2019-02-16Build heap done!Haidong Ji
1. Modifying code so it's easy to test is always worth it! Easier to identify the next concrete steps and carry them out! 2. Hand build a few arrays helped my understanding.
2019-01-29Network packet processing done!Haidong Ji
Oh man, I spent so much time on this, on and off for more than 16 hours. But it was worth it in the end! Initially I didn't even noticed that there is a "what to do" part in exercise file, so I started coding following my own intuition, which wasn't too bad. I felt like I was going places and passed a few tests but failed one or two test cases. That's when things started getting difficult. I tried thinking, paper/pencil, sleeping on it, and reading forums (coursera, edx has no discussion on this when I worked on it). I then realized the "what to do" part in exercise and started following it. I should have stashed my code based on my own intuition, but I didn't. I'm learning, after all. Then my code got really messy. I added a lot of if statements and temp variables to get by, but it consistently fails on grader test case 20. That test case input is from a file, so far I haven't learned proper way of reading file as input in junit, so I started simplify my code hoping that I can pass. In the end my code simplification did work and passed the grader, but I really should learn how to use file input in JUnit, or how to feed input file. Eclipse makes that easy, but not IDEA, at least not the version of 2018.2. 2018.3 supposedly has it, but I don't know how to upgrade it safely on my Manjaro yet. Woohoo, fun stuff!
2019-01-23Interim checkin. Network packet processing not done yet.Haidong Ji
2019-01-08Tree height non-recursive version done!Haidong Ji
Yay!!! I got rid of the recursion and used an iterative function to calculate height. The trick used was to use a queue. It turned out to be faster and consumed less memory. Fun stuff and I'm happy :)
2019-01-07Tree height recursive version done!Haidong Ji
Following example starter code, I had to specify stackSize when creating the thread. Without it, it won't pass tests due to stack overflow error. I'll still try to work out an iterative version using Queue. We'll see.
2019-01-01Check bracket done!Haidong Ji
Switching from Eclipse to Jetbrains IDEA, still using TDD methods. So far not bad. I like the fact that by using different IDEs, I can see what kind of help the IDE provides (coding style, best practices, etc.). That can be helpful.