<feed xmlns='http://www.w3.org/2005/Atom'>
<title>AlgoDesignAndTechniqueEdxJava, branch master</title>
<subtitle>UCSD Algorithmic Design and Techniques exercises done in Java. https://www.edx.org/course/algorithmic-design-techniques-uc-san-diegox-algs200x
</subtitle>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/'/>
<entry>
<title>Adding course slides and exercises.</title>
<updated>2018-12-29T21:14:53+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-29T21:14:53+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=2b118544a9192429024570f84de095d36d31d271'/>
<id>2b118544a9192429024570f84de095d36d31d271</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Max exp value with paren done!</title>
<updated>2018-12-28T20:58:39+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-28T20:58:39+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=27e7cf18d35a1dc2c8ad2acf9a77b2799d884a43'/>
<id>27e7cf18d35a1dc2c8ad2acf9a77b2799d884a43</id>
<content type='text'>
Wow, translating the algo into code was tricky! Debugging was
challenging, frustrating, and ultimately rewarding. Two debugging
takeaways I can think of now:
1. Make the test case small, so it's easy to trace the whole thing
through;
2. For bigger test case, the example from lecture notes was helpful. I
just needed to set breakpoint intelligently to see the min and max
arrays.

Also, initializing the min and max value, then use the Math.min and
Math.max was interesting. I may need to remember that, that's why I have
the notes here!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Wow, translating the algo into code was tricky! Debugging was
challenging, frustrating, and ultimately rewarding. Two debugging
takeaways I can think of now:
1. Make the test case small, so it's easy to trace the whole thing
through;
2. For bigger test case, the example from lecture notes was helpful. I
just needed to set breakpoint intelligently to see the min and max
arrays.

Also, initializing the min and max value, then use the Math.min and
Math.max was interesting. I may need to remember that, that's why I have
the notes here!</pre>
</div>
</content>
</entry>
<entry>
<title>Knapsack partition3 done!</title>
<updated>2018-12-27T15:48:28+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T15:48:28+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=993716627a616e821aefd8707230221d0dac6cd7'/>
<id>993716627a616e821aefd8707230221d0dac6cd7</id>
<content type='text'>
I used the "sleep on it" technique and the algo came to me about the
time I fall asleep. I started working on this based on algo I thought in
my head first thing after my run and shower, and it worked! I then went
to edX forum to see what other people are saying. Frankly those forum
posts were confusing to me.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I used the "sleep on it" technique and the algo came to me about the
time I fall asleep. I started working on this based on algo I thought in
my head first thing after my run and shower, and it worked! I then went
to edX forum to see what other people are saying. Frankly those forum
posts were confusing to me.</pre>
</div>
</content>
</entry>
<entry>
<title>Knapsack maximize gold done!</title>
<updated>2018-12-27T00:02:55+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T00:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=e09a3494e3f3b957b10402d9252a0bddec4cc908'/>
<id>e09a3494e3f3b957b10402d9252a0bddec4cc908</id>
<content type='text'>
It was a bit tricky translating algo in course slide to code, especially
regarding array indexing. I left a bit and walked the dogs. After I came
back, my mind was clearer than before. Debugging after that solved the
problem!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It was a bit tricky translating algo in course slide to code, especially
regarding array indexing. I left a bit and walked the dogs. After I came
back, my mind was clearer than before. Debugging after that solved the
problem!</pre>
</div>
</content>
</entry>
<entry>
<title>Longest subsequence (3 seqs) done!</title>
<updated>2018-12-25T21:56:40+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T21:56:40+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=e3e21cb0f76d24bc365898efe5a45b59226da00e'/>
<id>e3e21cb0f76d24bc365898efe5a45b59226da00e</id>
<content type='text'>
Not too bad after case for 2 seqs is done. Just needed to add one more
dimension and take care to set values.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Not too bad after case for 2 seqs is done. Just needed to add one more
dimension and take care to set values.</pre>
</div>
</content>
</entry>
<entry>
<title>Longest Subsequence (betwee 2) done!</title>
<updated>2018-12-25T17:12:42+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T17:12:42+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=1c6c9657a6432fc1d7069ddf8dd106f7a614fbed'/>
<id>1c6c9657a6432fc1d7069ddf8dd106f7a614fbed</id>
<content type='text'>
This one is pretty tricky. I solved it after reading online:
http://www.cs.umd.edu/~meesh/351/mount/lectures/lect25-longest-common-subseq.pdf
https://www.geeksforgeeks.org/longest-common-subsequence-dp-4/

To find a good test case that reveals the bug, I tried stress testing
(in commented out code), but the naive but correct algo is so
inefficient that I didn't have enough patience to let it finish. Anyway,
good practice of stress testing anyway.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This one is pretty tricky. I solved it after reading online:
http://www.cs.umd.edu/~meesh/351/mount/lectures/lect25-longest-common-subseq.pdf
https://www.geeksforgeeks.org/longest-common-subsequence-dp-4/

To find a good test case that reveals the bug, I tried stress testing
(in commented out code), but the naive but correct algo is so
inefficient that I didn't have enough patience to let it finish. Anyway,
good practice of stress testing anyway.</pre>
</div>
</content>
</entry>
<entry>
<title>Longest Common Subsequence of two sequences not done</title>
<updated>2018-12-23T22:02:16+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-23T22:02:16+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=c4ef43d3e77450b45bb7fb988bff0923ef8276fe'/>
<id>c4ef43d3e77450b45bb7fb988bff0923ef8276fe</id>
<content type='text'>
I do want to record this because the algos were written based on lecture
slides, and it passed all my own tests. However, it didn't pass test 14
of 37 from course grader. I checked forums in both edX and Coursera, I
was not alone in having that issue, but neither forums provided the
answer to the 14th test case used by the grader.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I do want to record this because the algos were written based on lecture
slides, and it passed all my own tests. However, it didn't pass test 14
of 37 from course grader. I checked forums in both edX and Coursera, I
was not alone in having that issue, but neither forums provided the
answer to the 14th test case used by the grader.</pre>
</div>
</content>
</entry>
<entry>
<title>String Edit Distance done!</title>
<updated>2018-12-22T03:24:14+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-22T03:24:14+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=4c1b19574b95e9db2c65f72b94bc55a86e4d6687'/>
<id>4c1b19574b95e9db2c65f72b94bc55a86e4d6687</id>
<content type='text'>
Implementing the algo described in lecture. Getting 2 dimensional array
indexing right took a bit of time. Looking at the picture helped me in
realizing that the dimention should have been n+1 by m+1. First time
dealing with string edit distance and alignment game, pretty
interesting!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implementing the algo described in lecture. Getting 2 dimensional array
indexing right took a bit of time. Looking at the picture helped me in
realizing that the dimention should have been n+1 by m+1. First time
dealing with string edit distance and alignment game, pretty
interesting!</pre>
</div>
</content>
</entry>
<entry>
<title>Primitive Calculator done!</title>
<updated>2018-12-20T02:36:14+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-20T02:36:14+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=f76bab93b3b58df4510a480d28e547125b5f3020'/>
<id>f76bab93b3b58df4510a480d28e547125b5f3020</id>
<content type='text'>
Once again, this is a challenging but fun puzzle to solve. Key
reflections are:
1. It pays to read and try to understand the problem as early as
possible. "Sleeping on it" really, really helps. Deep appreciation and
clarity came as I was thinking about it before falling asleep, walking
the dogs, and just be;
2. Small steps, but do take them! They lead to success! Hooray :)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Once again, this is a challenging but fun puzzle to solve. Key
reflections are:
1. It pays to read and try to understand the problem as early as
possible. "Sleeping on it" really, really helps. Deep appreciation and
clarity came as I was thinking about it before falling asleep, walking
the dogs, and just be;
2. Small steps, but do take them! They lead to success! Hooray :)</pre>
</div>
</content>
</entry>
<entry>
<title>Coin change Dynamic Programming done!</title>
<updated>2018-12-18T03:18:43+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-18T03:18:43+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxJava/commit/?id=1e7ce107613c578fdb99d3480e2e04e351434ac6'/>
<id>1e7ce107613c578fdb99d3480e2e04e351434ac6</id>
<content type='text'>
Easy implementation of the algorithm described in course slide. It
helped that I named variables according to the pseudo code. Getting
array indexing right is always a bit tricky so pay attention.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Easy implementation of the algorithm described in course slide. It
helped that I named variables according to the pseudo code. Getting
array indexing right is always a bit tricky so pay attention.</pre>
</div>
</content>
</entry>
</feed>
