<feed xmlns='http://www.w3.org/2005/Atom'>
<title>AlgoDesignAndTechniqueEdxCpp, branch master</title>
<subtitle>UCSD Algorithmic Design and Techniques exercises done in C++. https://www.edx.org/course/algorithmic-design-techniques-uc-san-diegox-algs200x
</subtitle>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/'/>
<entry>
<title>Max expression with paren done!</title>
<updated>2018-12-29T02:12:36+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-29T02:12:36+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=11e95e20033e8bb9d71c415a319ddfb4546fba34'/>
<id>11e95e20033e8bb9d71c415a319ddfb4546fba34</id>
<content type='text'>
Thanks googletest! I figured out the way to convert char to int using
the minus '0' trick.

All done with all exercises for UCSD Algo MicroMaster first course!
Woohoo, what fun! I'm very happy :) On to more fun stuff! I'll try
different IDEs. So far I've used Eclipse for all exercises. But for next
one, I'm thinking of trying Jetbrains IDEA, PyCharm, and possibly
Code::Blocks for C/C++.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Thanks googletest! I figured out the way to convert char to int using
the minus '0' trick.

All done with all exercises for UCSD Algo MicroMaster first course!
Woohoo, what fun! I'm very happy :) On to more fun stuff! I'll try
different IDEs. So far I've used Eclipse for all exercises. But for next
one, I'm thinking of trying Jetbrains IDEA, PyCharm, and possibly
Code::Blocks for C/C++.</pre>
</div>
</content>
</entry>
<entry>
<title>Knapsack partition3 done!</title>
<updated>2018-12-27T16:38:46+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T16:38:46+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=b9808ba0d4ff582a30f3a407fb11078232797009'/>
<id>b9808ba0d4ff582a30f3a407fb11078232797009</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Knapsack maximize gold done!</title>
<updated>2018-12-27T02:27:48+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-27T02:27:48+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=e7d4f50b766be809373a465767dfe3e05ac2ad37'/>
<id>e7d4f50b766be809373a465767dfe3e05ac2ad37</id>
<content type='text'>
Interesting signal 11 segmentation fault problem. Once I changed the 2D
array to 2D vector, it worked:
//	int value[W + 1][j + 1];
	vector&lt; vector&lt;int&gt; &gt; value(W + 1, vector&lt;int&gt;(j + 1));</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Interesting signal 11 segmentation fault problem. Once I changed the 2D
array to 2D vector, it worked:
//	int value[W + 1][j + 1];
	vector&lt; vector&lt;int&gt; &gt; value(W + 1, vector&lt;int&gt;(j + 1));</pre>
</div>
</content>
</entry>
<entry>
<title>Woohoo, longest subsequence (3 seqs) done!</title>
<updated>2018-12-25T22:56:44+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T22:56:44+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=b1ea15d245220ffe9a86c6d6c1e1f1f409de30f6'/>
<id>b1ea15d245220ffe9a86c6d6c1e1f1f409de30f6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Longest subsequences (2 seqs) done!</title>
<updated>2018-12-25T21:26:31+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-25T21:26:31+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=1559f265e9f1fcbedd1510949d02f7e661e652a7'/>
<id>1559f265e9f1fcbedd1510949d02f7e661e652a7</id>
<content type='text'>
Working with vector in C++ is much easier than arrays!. Plus in Java all
ints are initialized as 0, but not in C++, so I had to add logic to do
that properly.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Working with vector in C++ is much easier than arrays!. Plus in Java all
ints are initialized as 0, but not in C++, so I had to add logic to do
that properly.</pre>
</div>
</content>
</entry>
<entry>
<title>Edit Distance done!</title>
<updated>2018-12-22T21:39:10+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-22T21:39:10+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=0749c0815e49e490cbe4ecdf802a86713fcb0f11'/>
<id>0749c0815e49e490cbe4ecdf802a86713fcb0f11</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Primitive calculator done!</title>
<updated>2018-12-20T04:05:36+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-20T04:05:36+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=a5df8ebce9dcad0b60cf3c381b0e856a0f047ada'/>
<id>a5df8ebce9dcad0b60cf3c381b0e856a0f047ada</id>
<content type='text'>
Relatively easy since I worked it out in Java and Python. Slight change
of getting rid of the 2 dimensional array, which is probably better and
should have been done in Java and Python. Man, C++ is way more efficient
than Java and Python.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Relatively easy since I worked it out in Java and Python. Slight change
of getting rid of the 2 dimensional array, which is probably better and
should have been done in Java and Python. Man, C++ is way more efficient
than Java and Python.</pre>
</div>
</content>
</entry>
<entry>
<title>coin change Dynamic Programming done!</title>
<updated>2018-12-18T03:58:23+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-18T03:58:23+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=5b39eb1c082c9ab6ad32fc1547bf886f7f1b5333'/>
<id>5b39eb1c082c9ab6ad32fc1547bf886f7f1b5333</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Closest Pair done in C++!</title>
<updated>2018-12-17T14:43:36+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-17T14:43:36+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=6f3a936cda8cb7ec03da98d078d5c34b430429f2'/>
<id>6f3a936cda8cb7ec03da98d078d5c34b430429f2</id>
<content type='text'>
Finally Divide and Conquer section is finished. A lot of work but so
much fun!

A few take aways:
1. Be careful when copying code over from Java to C++. Java does
parameter passing through reference as default, but I forgot to add "&amp;"
in C++ code, which caused my code not passing earlier;
2. Avoid unnecessary calculation. For example, the sqrt calculation is
not necessary, until the last step. Avoiding that in my Python code
saved a lot of time.
3. It seems that preallocate vector size, if you know beforehand, is a
good idea.

Woohoo, onto the next section!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Finally Divide and Conquer section is finished. A lot of work but so
much fun!

A few take aways:
1. Be careful when copying code over from Java to C++. Java does
parameter passing through reference as default, but I forgot to add "&amp;"
in C++ code, which caused my code not passing earlier;
2. Avoid unnecessary calculation. For example, the sqrt calculation is
not necessary, until the last step. Avoiding that in my Python code
saved a lot of time.
3. It seems that preallocate vector size, if you know beforehand, is a
good idea.

Woohoo, onto the next section!</pre>
</div>
</content>
</entry>
<entry>
<title>Organize lottery done!</title>
<updated>2018-12-10T03:03:28+00:00</updated>
<author>
<name>Haidong Ji</name>
</author>
<published>2018-12-10T03:03:28+00:00</published>
<link rel='alternate' type='text/html' href='https://code.haidongji.com/AlgoDesignAndTechniqueEdxCpp/commit/?id=956e0d50a9f0bea2752cc1a84ec26bc72416ce60'/>
<id>956e0d50a9f0bea2752cc1a84ec26bc72416ce60</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
